What do you want to achieve? When there is 0 players or the game ended make a loop not run.
What is the issue? Doesnt stop.
local speed = 15
local gameRunning = game.Workspace.data.gameRunning.Value
local playersLeft = game.Workspace.data.playersLeft.Value
local lavaSpeed = speed/100
wait(5)
while wait(0.01) do
if gameRunning == false then print("first") elseif playersLeft == 0 then print("second") else print("third")
script.Parent.Size = Vector3.new(script.Parent.Size.X,script.Parent.Size.Y,script.Parent.Size.Z+lavaSpeed)
script.Parent.CFrame = CFrame.new(script.Parent.CFrame.X,script.Parent.CFrame.Y,script.Parent.CFrame.Z+lavaSpeed)
end
end
You are making the values constant instead of changing them every loop. Here is a fix:
local speed = 15
local lavaSpeed = speed/100
wait(5)
while wait(0.01) do
local gameRunning = game.Workspace.data.gameRunning.Value
local playersLeft = game.Workspace.data.playersLeft.Value
if gameRunning == false then print("first") elseif playersLeft == 0 then print("second") else print("third")
script.Parent.Size = Vector3.new(script.Parent.Size.X,script.Parent.Size.Y,script.Parent.Size.Z+lavaSpeed)
script.Parent.CFrame = CFrame.new(script.Parent.CFrame.X,script.Parent.CFrame.Y,script.Parent.CFrame.Z+lavaSpeed)
end
end