Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Health not changing?

Asked by
FiredDusk 1466 Moderation Voter
8 years ago

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)
0
WHat is this a hopperbin or tool? User#5978 25 — 8y
0
This is in workspace. There is a part and in the part they have a surfacegui then TextButton then TextLabel then Script FiredDusk 1466 — 8y
0
Is this a local script or just a script? UltraUnitMode 419 — 8y
0
script FiredDusk 1466 — 8y

1 answer

Log in to vote
0
Answered by
xuefei123 214 Moderation Voter
8 years ago

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.

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 FiredDusk 1466 — 8y
0
Wait, what was the error? xuefei123 214 — 8y
Ad

Answer this question