So basically I have this game where you go around collecting stuff. I don't have an idea on what I do for when everyone finds the objects, so I'm just trying to make the game kick everyone when all the objects have been found.
Here is my script
local player = game:GetService("Players")
local RS = game.ReplicatedStorage
local PN = RS.PlayerName
if PN.Value == "Restarting..." then
wait(10)
for i, player in pairs(player:GetPlayers()) do
player:Kick("Game has ended!")
end
end
BTW the PN part isnt only for playerName, its a StringValue that changes the text of a label I have in StarterGUI, so i'm basically trying to make it so when the text is saying "Restarting..." wait 10 seconds then kick everyone but when i'm testing the game it doesn't kick. I'm not to familiar with using :Kick so I could just be doing something wrong.

3 comments
is PlayerName a child of ReplicatedStorage as it worked fine for me when i tried your code
make sure PlayerName is a string value
Yes, PlayerName is a string value and PlayerName is also a child of ReplicatedStorage, if that were the case I would have gotten an error, but the problem is i'm not getting any errors soo