I’m making a spawner and Im also having an admin tab where admin’s can use it if needed for things such as checking model info of spawnable items and kicking a player. My issue is that when I type in a Text Box a player name or anything, it gives me this error:
Anyone got any ideas? It looks like it gets a blank value.
Heres my code:
local Player = script.Parent.Parent.PlayerName.Text
script.Parent.MouseButton1Click:Connect(function()
game.Players[Player]:Kick('An Admin has kicked you from this route session.')
end)
It’s because the “Player” variable refers to the actual text of the textbox at the moment the game stats, not the PROPERTY of “text.” (so even if you change the text, it’ll still be referring to the text that was at the start of the game). Instead, do this:
script.Parent.FocusLost:Connect(function()
game.Players[script.Parent.Text]:Kick('An Admin has kicked you from this route session.')
end)