Simple lua question: Having trouble with an if/then + GetVelocity argument

I’m making my first lua script, where a melon follows you around. Here it is, in its entirety:

The issue is at the end: when I add the bolded section, the entire script breaks. Without the bolded part, everything works fine and the melon follows you around. I looked at the wiki (which is where I got the statements), but I still can’t figure out what the issue is.

Use [lua] tags for code.

if physobj:GetVelocity():Length() < 5000 then

it’s probably breaking because there’s an error, and that error is probably that physobj doesn’t exist
you can either assign it to self:GetPhysicsObject(), or you can just use it without a variable like you do on the next line

also, I might be wrong, but I think self.Entity is deprecated (or that might just be sweps)

[editline]a[/editline]

also, the post above mine

Hooray, " if self:GetVelocity():Length() < 50 then " was the magic combination. Thank you guys for the help!