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

Output tells me that there is an error in a BotKicker Script?

Hey there! As we ROBLOX Players know: There are Bots. MANY Bots. So I wanted to deliver the best experience to my Server Players and made a BotKicker in ServerScriptService as a Script. Now when I attempt to play the Game inside of ROBLOX Studio it says following:

ServerScriptService.BotKicker:5: attempt to index nil with "AccountAge"

Now I went trough the script and couldn't find a reason for this to happen. The script:

local minimumAge = 15
local kickMessage = "Sorry, but your Account must be atleast 15 days old to join this game. Please use an account that is over 15 days old and try again."

game.Players.PlayerAdded:Connect(function()
	if player.AccountAge < minimumAge then
		player:Kick(kickMessage)
	end
end)

I hope somebody can help me with this :/ Have a nice day!

2 comments

0

on line 4 player is nil, you should do game.Players.PlayerAdded:Connect(function(player)

0

Okay, Thank you so much! :D

1 answer

✓ Accepted answer

In,

game.Players.PlayerAdded:Connect(function()

You need to add "player" between the paraenthesis after function.

You need to specify the argument that is returned by the PlayerAdded event.

1 comment

0

Okay, Thank you so much! :D But didn't i specify the argument by Players.PlayerAdded?

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