the first line was the only line that was cut off for some reason. Its fixed now. My troubles is that i dont know how to make the helmet appear and give hp when clicked.
So what you can do is im guessing there is a Clickdetector in this and you want it to give HP when clicked. So what you can do is:
local Helmet = script.Parent
local ClickDetector = game.workspace.Helmet.ClickDetector
local Amt = "Amt Of HP"
function OnActivation(player)
local char = player.Character
local Humanoid = Character.Humanoid
Humanoid.Health = Humanoid.Health + Amt
print("Helmet Equipped")
end
Helmet.ClickDetector.MouseClick:Connect(OnActivation)
Tool consist of handle and other stuff. Habdle is basicly your workspace model. You can put the script inside your tool and detect if tool is equiped, we should increase Humanoid’s health.
local Helmet = script.Parent
local Amt = "50"
function OnActivation(player)
local char = player.Character
local Humanoid = Character.Humanoid
Humanoid.Health = Humanoid.Health + Amt
print("Helmet Equipped")
end
Helmet.Activated:Connect(onActivation)
This is as close as i could get but it seems to not work, when i click the print wont go through, could u help me with this
I am also trying to make it so it gives the hp when you click it when you are holding the tool did I do that correct?
local Helmet = script.Parent
local Amt = "50"
function OnActivation(player)
local char = player.Character
local Humanoid = Character.Humanoid
Humanoid.Health += Amt
print("Helmet Equipped")
end
Helmet.Activated:Connect(OnActivation)
if you mean by info, that is the handle of the tool and when i have the tool out and click I want you to get extra hp on top of your normal hp. This is also the tool
local Helmet = script.Parent
local Amt = 50
function OnActivation(player)
local char = player.Character or player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid.Health += Amt
print("Helmet Equipped")
end
Helmet.Activated:Connect(OnActivation)
yea I realized I was trying to add with a string which is dumb
local tool = script.Parent
local health = 200 -- You can set your value
local function onActive()
local hum = script.Parent.Parent.Humanoid
hum.MaxHealth = health
hum.Health = health
end
tool.Activated:Connect(onActiv)
You can change Health variable’s value to amount of health you need.