Why am i getting an error?

hello
@NotRichard (finally i get to @ the legendary account for a real reason)
the link is https://makecode.com/_i2FVwqaVX4j2
For some reason, it says i have an error…i ran the debugger and nothing came up. it didn’t even run with debugger on.
(its a game related to school…dont ask about the letter on the desk)

never mind, i found out why. I tried to save the player’s location before the player existed (failed cast on null’s are the worst). but does anyone know why the debugger wouldn’t run? i tried deleting all the code then restoring it, and it went back to normal…
maybe it runs for other people, though, i’m not sure

1 Like

You are calling the saveFile function every second, but it will crash if User isn’t assigned. I don’t know if this is the best fix, but you could try this:

It has to do with your save function, it saves using tilemap blocks, but the tilemap hasn’t loaded yet, so it returns something undefined resulting in game crash.

This fixes the problem simply by using 1 variable, I closed the unimportant ones so you can see the important ones.