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

Unknown Global Player, Why is that?

if player.Name == "Player 1" then
	player:Kick("This is a test")
	
end

1 comment

1

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?

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.