Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --!
- tool = script.Parent
- handle = tool.Handle
- keys = {}
- gui = tool.MedigunGui
- frame = gui.Frame
- function getPlayer()
- return tool.Parent:IsA("Backpack") and tool.Parent.Parent.Parent or game.Players:GetPlayerFromCharacter(tool.Parent)
- end
- function onHandleTouched(other)
- local human = other.Parent:FindFirstChild("Humanoid")
- if not human then return end
- local player = game.Players:GetPlayerFromCharacter(other.Parent)
- if not player then return end
- end
- function raycast(cf)
- local ray = Ray.new(cf.p, cf.lookVector * 200)
- return workspace:FindPartOnRay(ray, tool.Parent)
- end
- function noTargetSound()
- handle.medigun_no_target:Stop()
- handle.medigun_no_target:Play()
- end
- function onActivated()
- frame.Visible = false
- holding = true
- local p = tool.Parent.Humanoid.TargetPoint
- local n = raycast(CFrame.new(handle.Position,p))
- if n then
- local human = n.Parent:FindFirstChild("Humanoid")
- if human and human.Health > 0 then
- local dist = (human.Torso.Position - handle.Position).magnitude
- if dist > tool.Distance.Value then noTargetSound() return end
- gui.Lasso.Part = tool.Head
- gui.Lasso.Humanoid = human
- gui.Lasso.Color = tool.ActiveColor.Value
- tool.Head.BrickColor = tool.ActiveColor.Value
- tool.Bar.BrickColor = tool.ActiveColor.Value
- local sparkles = Instance.new("Sparkles")
- sparkles.SparkleColor = tool.ActiveColor.Value.Color
- sparkles.Enabled = false
- sparkles.Parent = human.Torso
- sparkles.Archivable = false
- local fire = Instance.new("Fire")
- fire.SecondaryColor = tool.ActiveColor.Value.Color
- fire.Parent = human.Torso
- fire.Archivable = false
- handle.medigun_heal:Stop()
- handle.medigun_heal:Play()
- local s1 = Instance.new("Sound")
- s1.SoundId = "http://www.roblox.com/asset/?id=10756104"
- s1.Volume = 1
- s1.Pitch = 1.25
- s1.Parent = human.Torso
- s1.Looped = true
- s1:Play()
- local s2 = Instance.new("Sound")
- s2.SoundId = "http://www.roblox.com/asset/?id=170791927"
- s2.Volume = 0.4
- s2.Pitch = 1
- s2.Looped = true
- s2.Parent = human.Torso
- Spawn(function ()
- wait(0)
- s2:Play()
- end)
- frame.Visible = true
- frame.TextLabelTargetName.Text = human.Parent.Name
- while holding and equipped do
- if human.Health <= 0 then break end
- local dist = (human.Torso.Position - handle.Position).magnitude
- if dist > tool.Distance.Value then noTargetSound() break end
- human.Health = math.min(human.MaxHealth, human.Health + tool.Rate.Value)
- local p = human.Health / human.MaxHealth
- frame.FrameHealth.Bar.Size = UDim2.new(1, 0, p * -1, 0)
- frame.FrameHealth.TextLabelPerc.Text = math.ceil(100 * p) .. "%"
- if human.Health < human.MaxHealth * .8 then
- sparkles.Enabled = false
- fire.Color = tool.Color.Value.Color
- else
- sparkles.Enabled = true
- fire.Color = tool.ActiveColor.Value.Color
- fire.Size = (math.sin(tick() * 5) + 1) / 2 * 2 + 4
- end
- wait()
- end
- Spawn(function ()
- for i = 1, 0, -.1 do wait() s1.Volume = i s2.Volume = i end
- s1:Stop()
- s2:Stop()
- s1:Destroy()
- s2:Destroy()
- end)
- sparkles.Enabled = false
- game.Debris:AddItem(sparkles, 3)
- fire.Enabled = false
- game.Debris:AddItem(fire, 3)
- gui.Lasso.Color = tool.Color.Value
- tool.Head.BrickColor = tool.Color.Value
- tool.Bar.BrickColor = tool.Color.Value
- gui.Lasso.Part = nil
- frame.Visible = false
- else
- noTargetSound()
- end
- end
- end
- function onDeactivated()
- holding = false
- gui.Lasso.Part = nil
- end
- function onKeyDown(key)
- end
- function onKeyUp(key)
- end
- function onEquipped()
- frame.Visible = false
- frame.BackgroundColor3 = tool.Color.Value.Color
- tool.Head.BrickColor = tool.Color.Value
- tool.Bar.BrickColor = tool.Color.Value
- gui.Parent = getPlayer():FindFirstChild("PlayerGui")
- gui.Lasso.Part = nil
- end
- function onUnequipped()
- gui.Parent = tool
- end
- tool.Equipped:connect(function (m)
- m.KeyDown:connect(function (k) keys[k] = true onKeyDown(k) end)
- m.KeyUp:connect(function (k) keys[k] = nil onKeyUp(k) end)
- equipped = true onEquipped(m)
- end)
- tool.Unequipped:connect(function () holding = false equipped = false onUnequipped() end)
- tool.Activated:connect(function () holding = true onActivated() end)
- tool.Deactivated:connect(function () holding = false onDeactivated() end)
- handle.Touched:connect(function (...) onHandleTouched(...) end)
- --10/14/12 1:51 PM
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement