Invisible when you're standing still but not when you aren't.

So i’m making a swep and I need it so your alpha is 10 when you aren’t moving, and 255 when you are. I got this but all it does is make everyone invisible.

[lua] if self.Owner:GetVelocity():Length() == 0 then
self.Owner:SetColor(255, 255, 10)
else
self.Owner:SetColor(255, 255, 255)

end

end[/lua]

also, if you could make the weapon have an alpha of 10 when you don’t move aswell. help is appreciated.

Why it would make everyone invisible, I don’t know - SetColor( red, green, blua, alpha ) is the proper syntax. You’re setting the player’s blue to 10.

you missed a 255.
255,255,255,10 and 255,255,255,255.

[editline]12:07PM[/editline]

The missing alpha value defaults to 0.

yeah, but it does it for everyone… I’m putting it in my swep in the SWEP.Think() area, why is it doing this :confused:

[editline]01:25AM[/editline]

it needs to work for one person and only work when you aren’t moving

Alpha values default to 255.

Ignore my error at the top of the thread, it was 255 255 255 10. but I copied the wrong version to the thread.

-snip-

They never do when I miss a 255. :saddowns:

http://img3.imageshack.us/img3/3848/alphadefaultsto255.jpg

:smile:

Could someone help me instead of just debating?