if player.Name == "Player 1" then
player:Kick("This is a test")
end
COMMUNITY QUESTION
Unknown Global Player, Why is that?
1 answer
Player is not in any hierarchy or even exists. Player is not identified. Here is an example of a script that identifies and kicks the player if it's Player 1:
game.Players.PlayerAdded:connect(function(player)
if player.Name == "Player 1" then
player:Kick("This is a test")
end
end)
Or if it's a LocalScript:
local player = game.Players.LocalPlayer
if player.Name == "Player 1" then
player:Kick("This is a test")
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
It's because you never defined what player is. It's expecting player to be a variable defined in your script but it does not exist. What exactly are you trying to do?