hey, i made a healpad script but it dont work
script.Parent.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid then humanoid.Health = humanoid.Health + 25 wait(1)
end
end)
hey, i made a healpad script but it dont work
script.Parent.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid then humanoid.Health = humanoid.Health + 25 wait(1)
end
end)
I believe you are trying to do a cooldown so it wont heal him fast. Well your script is almost correct. Let me fix it:
debounce = false
time = 1 --how long you want to wait (cooldown) before you can heal again
script.Parent.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if debounce == false then debounce = true --We set the debounce to true for the cooldown
if humanoid then
humanoid.Health = humanoid.Health + 25 --You cant just type hum.Health = +25.. it wont work.
wait(time) --we wait
debounce = false --debounce = false
end
end
end)
Good luck, keep scripting.
Good answer, though findFirstChild() is depreciated. Should be FindFirstChild()
I didnt notice I typed findFirstChild, sorry. I mean FindFirstChild.
@HeyItzDanniee did you know that you can also heal the Humanoid by doing TakeDamage(-25)?
@MCAndRobloxUnited Seriously? Nice. Didn't know that, that's new. Thanks.
Hey, i tried it. But dont work. I tested where the problem is and i put a print("test") after the if humanoid. And it did not show up. So may this be the problem ?
Im now trying to reinstall studio because i thing something is wrong with it. Even Scripts from the internet dont work.
It should work as long as the script is a ServerScript inside the part you touch. Also... Uninstall ROBLOX and ROBPOX STUDIO, reboot your PC and then download ROBLOX Player and ROBLOX Studio again.
Trust me, had some issues with my studio too. Thanks to roblox I fixed it. Thats how I fixed it /\
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
your lua brackets didnt work either
any errors? Try doing a print test. Is it a server script....
The code is right, it must just how you implemented it.