I'm making this to where it kicks the player when they're not in that certain age. It's not kicking the player, how come?
function OnEntered(Player) if Player.AccountAge <= 20 then local Player = game.Players:GetPlayerFromCharacter(Player.Parent) Player:Kick("Your account must be 20 days old to play.") end end game.Players.PlayerAdded:connect(OnEntered)
SoftlockedUnderZero is right. You should only do:
function OnEntered(Player) if Player.AccountAge < 20 then Player:Kick("Your account must be 20 days old to play.") end end game.Players.PlayerAdded:Connect(function(OnEntered)
Hope this helps!
Why line 3? It doesn't make sense. What's your intention with line 3? Only the Player Instance has the kick function, not the model.
I suggest you remove line 3, because the player variable is already given to you.