Hey there, so I am basically making an elevator for my story game but, when there's 0 players the elevator doesnt stop countdowning even though the PlayerCount.Value is set to 0, Can anyone help me with this?



local Elevator = workspace.Elevator
local PlayerCount = Elevator.Count
local Event = game.ReplicatedStorage.Event
local Event2 = game.ReplicatedStorage.Event2


Event.OnServerEvent:Connect(function()
	PlayerCount.Value -= 1
end)

Event2.OnServerEvent:Connect(function()
	PlayerCount.Value += 1
	for i = 10,0,-1 do
		if PlayerCount.Value ~= 0 then
			wait(1)
			Elevator.CountDown.Value -= 1
		else
			Elevator.CountDown.Value = "Waiting for players..."
			break
		end
	end
end)


Also this is not the exact code I'm just giving an example

4 comments

0

What is Elevator in this case? Is it an IntValue?

0

^ if it is then use .Value, possibly op forgot that lel. Deducing this off of line 2.

0

it is a intvalue

0

also sorry i forgot to add .value but that doesnt fix it