Hello, I’m wanting to store the amount of players in a value so that the game can keep track of how many players are left and to know who to reward wins to at the end of a round. I keep getting an ‘attempt to get length of instance error’ if I try and add
PlayersInRound.Value = PlayersInRoundValue + #players. at line 16.
If I don’t put the line there, it instead errors with an ‘attempt to call a string value’ error at line 55 with
Status.Value "There were no survivors."
I did look this up on the DevForum, but I didn’t find anything that was using it in the same context that I am using it for here.
RoundInProgress.Changed:Connect(function() if RoundInProgress.Value == true then for _, players in pairs(game.Players:GetChildren()) do players.InRound.Value = true local char = players.Character char.HumanoidRootPart.CFrame = MatchSpawn.CFrame end else for _, players in pairs(game.Players:GetChildren()) do local char = players.Character char.HumanoidRootPart.CFrame = Lobby.SpawnLocation.CFrame end end end)
for i = Results, 1,-1 do RoundInProgress.Value = true CanDropMeteors.Value = true wait(1) if PlayersInRound.Value > 0 then Status.Value = "Congratulations to the survivors!" elseif PlayersInRound.Value <= 0 then Status.Value "There were no survivors." end