Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What do i do if my else statement doesnt function as intended?[FIXED]

Asked by 3 years ago
Edited 3 years ago

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

0
What is Elevator in this case? Is it an IntValue? RazzyPlayz 497 — 3y
0
^ if it is then use .Value, possibly op forgot that lel. Deducing this off of line 2. greatneil80 2647 — 3y
0
it is a intvalue BuildAboatTest124 51 — 3y
0
also sorry i forgot to add .value but that doesnt fix it BuildAboatTest124 51 — 3y

Answer this question