#I cant fix this eror code
1 messages · Page 1 of 1 (latest)
<@&1349109171240439858>
Please give more information
It can't find the node. make sure it exists in the path specified.
would a picture of my code help
i tried to specifie it but there was still and eror and i dont know if i did it corectly
you can show the code part that causing error and show the node tree
Ok I will
and is the scene global or smth ?
I don’t know I just started learning so I am not sure
good 
When you surround some words with single backticks like `this`, it will be formatted as code.
You can also include code blocks by surrounding the code with three backticks. If you add "swift" then you will also get basic syntax highlighting:
```swift
print("hello world")
```
Discord will then show it as a code block like this:
print("hello world")
If your code snippet is rather long, you can upload it to a text paste site. One option that supports syntax highlighting for GDScript is https://bpa.st/
You can embed code into the chat so its more readable than a screenshot.
i mean just a part of code thats refering to that node and a node tree is enought probly
it is so should i rename all the player with Player
or just put small p in the code
i will try that
instead $Player - $player
Yeah, node names are case sensitive. You can have a player and a Player and they'll be considered two different things. Same goes with a lot of things.
diferent eror now
haveing somone else to look over my code is so helpfull thank you i will test now
i changed it and its still eroring
and the old erors are still there with the new_game and the player
the issue is the node is from diffrent scene
try replacing it with $"../StartPosition"
Then reference the node
If it's from a parent node
Or use the get_node method
yep
It looks like it's being called by the player though?
so what should i do i should replace somthing with somthing sorry
get_tree().get_node("/StartPosition")
were do i enter that
Replace your $StartPosition with that exact line
ok thank you
to be clear, you need to keep the full stop and everything after it.
should i replace all $startpositions
If you're calling it anywhere else, I'd recommend swapping it with a variable that you can store the position in.
...
startPos.position = pos```
i replaced $StartPosition in both main and player and it removed one of the erors but now we have this one
wait
the start()
doenst need to get_tree
you can leave $StartPosition
like it was before
ok so i should revert it
idk wait
get_tree().root.get_node("/StartPosition")
alright you can rever it to $StartPosition
make sure you apply get_tree.... to the player.gd
ye only player.gd would need that change
sory for confusion
like player is in diffrent scene so it needs to get_tree.....
so i dont need to change main but i should add get_tree().root.get_node("/StartPosition") to player
yes
ok i will test
so this
to this
i tested this change and it erored again
the eror is also bringing me to new_game
Well I have to move locations so I won’t be able to test for a while but thank you for your help i don’t know why it’s not working well I will keep looking but if anyone has any ideas it would be greatly appreciated thank you
no problem
node /StartPosition doesn't exist, because it's under your main scene. the full path would be /root/main/StartPosition
but getting it that way is incredibly clunky and error-prone. don't do that.
this is why, in the tutorial in the docs, the main.new_game function provides $StartingPosition.position as an argument to $Player.start
that way, player doesn't have to know about the existence of a StartPosition node, it just needs to be told by the main script where to go
but going back through and comparing to the tutorial now
your actual problem is that you're trying to set the StartPosition's position from the player script, using the value of pos that it just got from StartPosition's position
this code
func start(pos):
position = pos
is meant to set the player's own position to whatever it's given as the pos parameter
so when the main scene script calls
func new_game():
score = 0
$Player.start($StartPosition.position)
it reads the position vector from the StartPosition node, passes that vector into the start function on the Player node, which then uses that vector - now just called pos - to set its own position
Please don't overuse the ping role, it had only been 7 minutes since op posted, and the post was missing crucial information
(but please do ping me if replying to me, so that i see it)
so what do i switch out i am sorry i am a litle confused
were do i add that in