Godot Version
Godot 4.2
Question
Im trying to make it so that it always displays how many coins the player has but whenever i try to run this it never actually runs, and i dont know what to do
(code)
Godot 4.2
Im trying to make it so that it always displays how many coins the player has but whenever i try to run this it never actually runs, and i dont know what to do
(code)
what you have to do is transform the int player.coin to string using str(player.coin)
i tried that and it just said this
What does your scene tree look like? From the error message, it looks like it can’t find the player node.
From what I can see, the problem is that the script is from the label. You should make the player change the .text value of the label and pass it its coin value
it runs now but it doesn’t display the coins
wait i never called the function lmao gimme a second
The problem is that you are looking for the player node within the same player. you just have to put str(coin)
ah, lemme try that
According to the docs its $MoneyCount.set_text(str(coins))
Try that out
still didnt work
What’d say?
Let me check
Where is “WorldTest” In your scene? If the MoneyCount is in a different scene it won’t work.
I think you are scripting for the wrong node. the main node in that scene is called “Node2D” make a new script on that node and try to set the text
While you’re at it. in godot you can drag and drop the nodes to get the path into your code.