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

How do I make a script that when a player enters a name, the other player gets killed?

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!

1 answer

✓ Accepted 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)

:)

3 comments

0

Oh, thanks! ;)

0

Np :)

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