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

Why does my kick GUI not kicking players? (assigning variables to textbox.text)

local input = game.StarterGui.ScreenGui.Frame.TextBox.Text

game.Players.PlayerAdded:connect(function(plr)

if input == plr.Name then

input:Kick()

end

end)

This script does not work, why?

2 comments

0

You're using Kick() on a property. Do plr:Kick().

0

exploitable

2 answers

Ok, so you are trying to kick a string or a text. That's like doing "roblox":Kick(), That won't work since Kick() requires a player instance to function. And what if the textboxe's text wasn't exactly the players name? We could lower case all all of the string's text and the player's name to see if it matches.

 local input = Textbox.Text
    
game:GetService("Players").PlayerAdded:Connect(function(player)
    if string.lower(input) == string.lower(player.Name) then
        player:Kick("You have been kicked by some random person lmao")
    end
end)

1 comment

0

string.lower() allows you to do something like enter RoBloXFan, which turns it all into lowercase(robloxfan)

You have to put the local script in a screenGui that has the Frame or TextBox. Then instead of game.StarterGui.ScreenGui.TextBox.Text, do

local input = script.Parent.TextBox.Text

-- Do the function Next --

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