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

how to fix my script to only let some pepole have acces to my game?

if game.Players.PlayerAdded:Connect(fucntion()  
if game.Players.LocalPlayer.Name == ("hokyboy,Kampatala") then
	script.Parent.Parent.Parent:Destroy()

end

so this is what i tried i first tried it with a loop(yes i was bening stupid) now i dont know how to fix this and is there a way to kick a player using this metod and then let the kick say Error:You dont have acces to this game?

1 answer

✓ Accepted answer

yes; and here is how you can do it

local allowed = {
	"Arsubia12",
	"bleh"
}


game.Players.PlayerAdded:Connect(function(player)
	for _, plr in pairs(allowed) do
		if player.Name:lower() == plr:lower() then
			return 0 ;
		end
	end
	
	player:Kick("You dont have acces to this game?")
end)

in the variable allowed, put in the names of the people that are allowed to join separated with commas

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