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

This Age Restrict script does not work at all, why? [STILL UNANSWERED!]

game.Players.PlayerAdded:connect(function(plr)
	if plr.AccountAge < 30 then
		plr:Kick()
	end
end)

Nothing happens when a new account joins

1 answer

You have to let the character spawn

If you kick a player too soon, the game doesn't like that. In short, you just have to wait for the Character of the player to spawn first.

game.Players.PlayerAdded:connect(function(plr)
	plr.CharacterAdded:wait()-- Waits for the character to spawn
	if plr.AccountAge < 30 then
		plr:Kick()
	end
end)

Good Luck!

If I helped, please don't forget to accept my answer.

6 comments

0

Still didn't work for me

0

I just tested it. Works fine.

0

Is the script disabled? And where is it located? Is it a Local Script or a regular one?

0

It is a regular one and it's in workspace, I do possibly have to note that the character gets removed after he joins immeditaly, other intro stuff and yeah.

3

That's the point :/

3

I think you should learn a little bit more about scripting @aaron8888, this script does what your basically asking.

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