"Unexpected token: Identifier:velocity"

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ElijahSleepsAlot

I keep getting this error.
error(9,1): Unexpected token: Identifier:velocity
the line I wrote: velocity = speed * direction
(for my 2d movement)

Typically this error has to do with where you’ve written that line of code. For example, you can’t execute code like this outside of a function body.

Please post your entire script, as it’s impossible to be specific without seeing the context of where this line of code is.

kidscancode | 2022-10-21 01:48

Where is velocity declared?

SteveSmith | 2022-10-22 11:10

:bust_in_silhouette: Reply From: SteveSmith

Your code is in the wrong place.