Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

my selfmade heal pad script dont work?

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)

3 comments

2

your lua brackets didnt work either

0

any errors? Try doing a print test. Is it a server script....

0

The code is right, it must just how you implemented it.

1 answer

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.

8 comments

1

Good answer, though findFirstChild() is depreciated. Should be FindFirstChild()

0

I didnt notice I typed findFirstChild, sorry. I mean FindFirstChild.

1

@HeyItzDanniee did you know that you can also heal the Humanoid by doing TakeDamage(-25)?

0

@MCAndRobloxUnited Seriously? Nice. Didn't know that, that's new. Thanks.

0

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 ?

0

Im now trying to reinstall studio because i thing something is wrong with it. Even Scripts from the internet dont work.

0

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.

0

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.