Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Vickyboi |
I’m trying to post a “Final time” on a victory screen for my game, but when I try to get the script where the variable is held, it gives me this error.
Invalid get index ‘ms’ (on base: ‘null instance’).
extends Label
onready var player_vars = get_node("res://Global.gd")
func _process(delta: float) -> void:
if player_vars.ms > 9:
player_vars.s += 1
player_vars.ms = 0
set_text(str(player_vars.s) + ":" + str(player_vars.ms))
func _ready() -> void:
pass # Replace with function body.
func _on_Ms_timeout() -> void:
player_vars.ms += 1
I put the global script as an autoload.
Here is the script for the global
extends Node
var ms = 0
var s = 0
If you need any more information, I’d be happy to provide