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

Health not changing?

Error: Parent is not a valid member

script.Parent.Parent.MouseButton1Down:connect(function()
		
		local Player = game.Players.PlayerAdded
		script.Parent.Text = "Muahahaha, I hope you learned a lesson >:P"
		
		Player.Parent.Humanoid.Health = 0

end)

4 comments

0

WHat is this a hopperbin or tool?

0

This is in workspace. There is a part and in the part they have a surfacegui then TextButton then TextLabel then Script

0

Is this a local script or just a script?

0

script

1 answer

Wow, this is terrible, you don't know even how to script.

script.Parent.Parent.MouseButton1Down:connect(function()

        local Player = game.Players.PlayerAdded--How does that define Player??
        script.Parent.Text = "Muahahaha, I hope you learned a lesson >:P"

        Player.Parent.Humanoid.Health = 0

end)

It should be,

game.Players.PlayerAdded:connect(function(p)
Player = p--It doesn't need a local, I know it has blue under it, but who cares?
end
script.Parent.Parent.MouseButton1Down:connect(function()
	Player.Character.Humanoid.Health = 0
        script.Parent.Text = "Muahahaha, I hope you learned a lesson >:P"
end)

Please do not give me bad rep for this, I am just answering someone who doesn't know scripting very well.

2 comments

0

LOL seems like you don't know how to script.. I got an error but I fixed it. And your script does not even work... :P

0

Wait, what was the error?

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