Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | CluelessCoder |
extends Label
@onready var label1 = $storyText
func _ready():
# Generate a random name and backstory for the player
var name1 = BioGenerator.NAMES[randi() % BioGenerator.NAMES.size()]
var backstory = BioGenerator.BACKSTORIES[randi() % BioGenerator.BACKSTORIES.size()].replace("{name}", name1)
# Set the labels to display the name and backstory
label1.text = "Name: " + str(name1)
label1.text = "Backstory: " + str(backstory)
#ERROR invalid set index 'text' (on base: 'null instance') with value type of 'String'
it uses a autoload dictionary for the random gen. if you want to see that to i’ll post it but i think the error has nothing to do with that script.
CluelessCoder | 2023-05-04 21:55
Edited to fix forum code formatting…
jgodfrey | 2023-05-05 00:22