while true do
wait()
if script.Parent.Parent.TextBox.Text == "..." then
if game.Workspace["script.Parent.Parent.TextBox.Text"]:FindFirstChild("Humanoid") ~= nil then
game.Workspace["script.Parent.Parent.TextBox.Text"].Head:Destroy()
end
end
end
✓ ANSWER ACCEPTED
How to input player's username on TextBox to run certain commands on them?
1 answer
✓ Accepted answer
screenGui = game.Players.PLAYERNAME.PlayerGui.ScreenGui
textBox = screenGui.TextBox
textButton = screenGui.FF
currentSelectedPlayer = nil
textBox.FocusLost:connect(function()
for i,v in pairs(game.Players:GetChildren()) do
if v.Name == textBox.Text then
currentSelectedPlayer = v
end
end
end)
textButton.InputBegan:connect(function(key)
if currentSelectedPlayer and key.UserInputType == Enum.UserInputType.MouseButton1 then
Instance.new("ForceField", currentSelectedPlayer.Character)
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thank you so much!