This works fine in Studio but when I go into the game…
So basically the IntValue stays at 0 no matter what and the PlrCheck script just stops printing after a bit.
Could it possibly be because of the player not entirely loading in right? That’s maybe the only thing I can really think of, your EndRound script looks fine though
wait(10)
print("Test")
while true do
script.Proto.Value = 0
wait(.29)
for _, player in pairs(game.Players:GetChildren()) do
if player.Character.HumanoidRootPart.Position.Y < 80 then
script.Proto.Value += 1
print("Proto Value: "..script.Proto.Value)
end
end
script.Final.Value = script.Proto.Value
print("Amount of players on field: "..script.Final.Value)
end
So that actually made it continue printing, but for the Invasion, Juggernaut, and Classic gamemodes the EndRound script fires even when the value is not 0. But somehow your idea fixed a lot. Thanks!
My guess is that you can’t define these variables like these:
Instead you’d need to do
while wait(.2) do
local stats = game.ServerScriptService.StatusBar
local plrs = game.ServerScriptService["Other Scripts"].PlrCheck.Final
if plrs.Value == 0 then
--Do the rest of the code line
end
end
Yes, but I have a second value called final that only sets to the value of proto after it completes the loop, and the EndRound scripts detects the final value.
CharacterAdded:Wait() instead of adding a 10 second wait wait(10)
Try this code inside the while loop
local Proto = script.Proto
local Final = script.Final
for _, player in pairs(game.Players:GetPlayers()) do
if player.Character.HumanoidRootPart.Position.Y < 80 then
Proto.Value += 1
end
end
Final.Value = Proto.Value
print("Amount of players on field: "..Final.Value)
Ok. So look at the pics of the explorer again, because Final is a second value that gets set to Proto’s value at the end of the loop. Also I don’t think it would take 10 seconds for a character to load in and also it would error if the character did not exist.
I did the same. Final value is being changed to the value of Proto. Sure it won’t take 10 seconds for the character to load but what about those with bad internet?