Randomizer Not Working

Godot Version

4.6

Question

Hiiiii! I feel as though im being silly here, but im trying to make a randomizer for a small project im making, but its not working- its not even printing anything?

extends Sprite2D

func on_timer_timeout():
	var roll_result = Globals.roll_num.randi_range(1,10)
	if roll_result >= 5:
		visible = false
		print("goodbye")
	else:
		visible = true
		print("Hello")

(This is on a sprite node, which has a timer as a child)

Oh and globals script :smiley:

extends Node

var roll_num = RandomNumberGenerator.new()

again, i feel as though im being silly haha, but thanks for helping<333

Did you connect the signals?
Do you have any errors in the console?

1 Like

I did and no i dont have a single error

If nothing prints or errors then the function is certainly not running, it isn’t connected to the timer or the timer isn’t running.

2 Likes