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

Extra health script won't work?

giver = game.Workspace.Fifty+ Health.Head

local player = game.Workspace.LocalPlayer

game.Worksace.player:GetPlayers("Humanoid")

health = 150

function onTouched(giver)
	if players:onTouched(giver) then
		player.Humanoid.Health(health)
	end
 end

script.Parent.Touched:connect(onTouched)

It's when you touch, you get 150 health, it won't work. Why?

1 comment

0

And here go down votes for no reason...

1 answer

function onTouch(part) 
	local humanoid = part.Parent:FindFirstChild("Humanoid") 
	if (humanoid ~= nil) then	-- if a humanoid exists, then
		humanoid.MaxHealth = 150	-- sets MaxHealth to 150
		humanoid.Health = 150 -- sets Health to 150
	end 
end

script.Parent.Touched:connect(onTouch)

Use this code above. Your code would not work for many reasons. Add the script to your part!

This discussion is preserved as it was. New answers, comments, and votes are closed.