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

How to input player's username on TextBox to run certain commands on them?

Asked by
Jxdenx 45
6 years ago
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

1 answer

Log in to vote
0
Answered by
blowup999 659 Moderation Voter
6 years ago
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)

0
Thank you so much! Jxdenx 45 — 6y
Ad

Answer this question