Topic was automatically imported from the old Question2Answer platform.
Asked By
20xxdd20
if speed == 100:
print("hello world!")
$Timer.start()
I have this code which checks if the player’s speed is 100 and if yes, it prints hello world! and starts a timer. But the script runs numerous times but I want it to print only once.
Make sure your time is set on one shot and create a boolean
if speed == 100 and timerSwitch:
timer.start()
timerSwitch = false
I created variables called:
onready var timer = $Timer
var timerSwitch : bool = true
Hello world will still be called multiple times, depending on how much you set your timer. To perform it only once, my code example but without timers, only the boolean.