I get the"Invalid operands 'String' and 'int' in operator '=='." error and I don't know why

func shoot ():
	if Input.is_action_just_pressed("Lclick"):
		
		
		rng = str(round(randf() + 1))
		
		if rng == 1:
			anim.play("swing")
		elif rng == 2:
			anim.play("swing2")

rng = str(round(randf() + 1))
replace
rng = round(randf() + 1)

3 Likes

These errors are easy to resolve if you specifically type your variables when you declare them:
var rng:int