Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

How do I make a script where I pull out a Tool and it Increases my health?

Asked by 10 years ago

Alright, so I wan't to pull out a Tool called Lightsaber, And upon pulling it out, It increases my health to 500.

2 answers

Log in to vote
0
Answered by
Thetacah 712 Moderation Voter
10 years ago

Not sure what you mean, but do you mean this? Put this script inside the tool.

local Tool =script.Parent
local Char = Tool.Parent.Parent.Character
local value = 500
Tool.Equipped:connect(function(mouse)
Hum = Char:WaitForChild("Humanoid")
if Hum ~= nil and Hum.Health ~=0 then
        Hum.Health = Hum.Health + value
    end
end

Ad
Log in to vote
-1
Answered by 10 years ago

Put this LocalScript into the Tool.

local plr = game.Players.LocalPlayer
local tool = script.Parent

tool.Equipped:connect(function()
    plr.Character.Humanoid.Health = plr.Character.Humanoid.Health + 500
end)

Answer this question