I need help with this for a gui.. Script:
function onClicked(click)
local plr = script.Parent.Parent.TextBox.Text
game.Players.plr.Character.Humanoid.Health = 0
end
script.Parent.MouseButton1Down:connect(onClicked)
Please try to answer!
I need help with this for a gui.. Script:
function onClicked(click)
local plr = script.Parent.Parent.TextBox.Text
game.Players.plr.Character.Humanoid.Health = 0
end
script.Parent.MouseButton1Down:connect(onClicked)
Please try to answer!
You are actually very very close. The error is on line 3. plr is a string, not a player, so you define that by using []'s.
function onClicked(click)
local plr = script.Parent.Parent.TextBox.Text
game.Players[plr].Character.Humanoid.Health = 0 --NOTE There is NO period after "Players"
end
script.Parent.MouseButton1Down:connect(onClicked)
:)
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
Oh, thanks! ;)
Np :)
Mind helping me with this too? Link https://scriptinghelpers.org/questions/3055/why-doesnt-my-door-script-work