I'm making an advanced game and everything is ok apart from this script. The number called game.ReplicatedStorage.Values.PlayerCount is not increasing in the script, so the game is instantly starting. How do I fix it? This is the code I tried:
game.Players.PlayerAdded:Connect(function(plr)
game.ReplicatedStorage.Values.PlayerCount.Value = game.ReplicatedStorage.Values.PlayerCount.Value +1
script.Parent.Parent.PlayerStats["Player"..game.ReplicatedStorage.Values.PlayerCount.Value].PlayerName.Text = plr.Name
script.Parent.Parent.PlayerStats["Player"..game.ReplicatedStorage.Values.PlayerCount.Value].Name = plr.Name
local plrStats = Instance.new("Folder")
plrStats.Name = plr.Name
plrStats.Parent = game.ReplicatedStorage.PlayerAssets
local plrInventory = Instance.new("Folder")
plrInventory.Name = "Inventory"
plrInventory.Parent = game.ReplicatedStorage.PlayerAssets[plr.Name]
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.PlayerStats[plr.Name].BackgroundColor3 = Color3.fromRGB(0, 255, 0)
script.Parent.Parent.PlayerStats[plr.Name].PlayerStatus.Text = "Ready"
game.ReplicatedStorage.Values.PlayersReady.Value = game.ReplicatedStorage.Values.PlayersReady.Value +1
script.Parent.Visible = false
end)
end)
Bit of help, please! Thanks!

5 comments
what kind of script is it in
Server Script (Regular Script)
odd, try moving line 2 to line 18 instead
That wouldn't work
Is the output giving you anything? Try waiting for the PlayerCount value to load in before doing anything with it.