Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Is there a way to have a time limit on a repeat?

Asked by 12 days ago

Hiya, I'm trying to trigger a remote event if the player does not press "q" within 5 seconds. I currently have this and I was wondering how I could make it so that if "Alert" doesn't stop playing before 5 seconds then it triggers the remove event. Thanks

repeat
    wait()
until script.Parent.Alert.IsPlaying == false
0
After 5 seconds it should fire a remote server. I know how to do remote servers and all that its just I don't know how to get the repeat to know when 5 seconds has passed paisley112 18 — 12d

3 answers

Log in to vote
0
Answered by
ADUPS 5
12 days ago

I would suggest making a variable that counts each second, then when the player presses Q you detect if that variable is 5 or more. OR just add a timer for 5 seconds, and if it has passed 5 seconds, you just not allow the player to press Q. Can't really give you a proper answer because of lack of the information, sorry.

Ad
Log in to vote
0
Answered by
starmaq 349 Moderation Voter
12 days ago
Edited 12 days ago

Well you can do

local number = 0
repeat
    wait()
    number = number +1
until script.Parent.Alert.IsPlaying == false or number == 5
0
no incapaxx 2426 — 12d
0
Wouldn't that just keep adding 1 to the number instead of only adding 1 each second? paisley112 18 — 12d
0
oh yeah sorry, add a wait() inside the scope starmaq 349 — 12d
Log in to vote
0
Answered by 12 days ago

Thanks for the help but I've decided to work around this instead since the system I intended would be tricky for new players

Answer this question