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

How to use repeat until? for a checker if a player is in my elevator

Asked by
hokyboy 270 Moderation Voter
4 years ago
local ElevatorPlayers = game.ReplicatedStorage.Players.PlayerValue.Value



repeat until ElevatorPlayers == ElevatorPlayers >1
print("Sucsess")
wait(5)

ServerScriptService.ElevatorScripts.Script:5: attempt to compare number with boolean Output error

0
What math function are you trying to do with >1? Benbebop 1049 — 4y
0
the value needs to be above 1 for the script to start hokyboy 270 — 4y
0
then it should be written as "repeat until ElevatorPlayers > 1", in your script its trying to treat the boolean operator (>) as an arithmetic operator (+, -, ^, etc.)  Benbebop 1049 — 4y
0
Also there is no end at the end of your loop. Benbebop 1049 — 4y

1 answer

Log in to vote
1
Answered by
Leamir 3138 Moderation Voter Community Moderator
4 years ago

Hello, hokyboy!

repeat until works as loops that waits for a certain condition

basically,

repeat (code) until (condition)

Your script should be:

local ElevatorPlayers = game.ReplicatedStorage.Players.PlayerValue.Value



repeat wait() until ElevatorPlayers > 1 -- Don't forget waits on all loops
print("Sucsess")
wait(5)

0
àctually, since the elevatorplayers variable is set above the loop as the current value at the time, it will never run. Despayr 505 — 4y
Ad

Answer this question