[HELP] Draw Velocity

Posts 1–8 of 8 · Page 1 of 1
[HELP] Draw Velocity
Hey, I wrote this script a few days ago to help show my velocity but its not working. I have no idea why its not.

Code:
local velocity = false
hook.Add("Think", "velocity", function()
if velocity then
	draw.DrawText( self.Entity:GetVelocity(), "ScoreboardText", ScrW() / 2 - 70, ScrH() - 63, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER)
end)

concommand.Add("velocity_toggle", function()
if velocity then
    velocity = !velocity
    LocalPlayer():ChatPrint("Velocity turned OFF")
else
    velocity = !velocity
    LocalPlayer():ChatPrint("Velocity turned ON")
end
end)
I tried fixing it but it never worked. Can you please help me?
Replace self.Entity with LocalPlayer()

LocalPlayer() returns the clients player entity when called client side. self.Entity is used elsewhere. I would explain it but I'm on my phone.

I think that's all you need to change, post back if it works or not.
Let's use a vector instead of a string, because strings are for bitches.
Atheon, I'm getting this error after I replaced the code

[ERROR] lua/bhop.lua:5: unexpected symbol near ')'
1. unknown - lua/bhop.lua:0
Code:
local velocity = false

hook.Add("HUDPaint", "velocity", function()
    if velocity then
        local a = LocalPlayer():GetVelocity()
        draw.DrawText(tostring(a), "ScoreboardText", ScrW() / 2 - 70, ScrH() - 63, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER)
    end
end)

concommand.Add("velocity_toggle", function()
    velocity = !velocity
    chat.AddText("Velocity bool: "..tostring(velocity))
end)
Should work
The issue with yours is that you forgot to put an end for your if statement. Sorry, didn't realize that before.
Thanks you guys, I got it working!
Then you should likely ask a moderator to close this.
Posts 1–8 of 8 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us