Hello, Having an issue with using body velocity: it only applies in one direction.
I’m trying to make a dash that’ll push you backwards, but since I’m applying it in a for loop, I’d like it to also apply when Im turning myself with mouselock on. My best guess is, as I’ve heard from someone else, that the BodyVelocity isn’t updating, and the code only recognizes it when it’s first set. I’ve seen a YouTube video try applying Run.HeartBeat function, but it didn’t work for me; and neither did Run.Heartbeat:Wait(). Also, they make the dash too quickly anyways.
BodyVelocity is also applied in other parts of my game to make them controllable by moving with WASD or also mouselock, so I really need it to work out
Example:
NOTE: I am firing from a remote function inside the tool, which a script inside ServerScriptService connect and make the player dash. Not sure if this has a connection with latency of how far and wide the code has to travel or whatever but the local script (which invokes) has 380 lines, and the server script (receiving) has 1200 lines
Connection = game:GetService("RunService").Stepped:Connect(function()
if torso and BackForce then BackForce.Velocity = torso.CFrame.lookVector * -100 end
end)
wait(1) -- change the number to how long you want it to last
if Connection then Connection:Disconnect() end
if BackForce then BackForce:Destroy() end
How ever this was all coded here and not tested, but you might give it a shot.
It works somewhat; theres a slight delay though. Its slower when I handle it on a server script with a bunch of other code, and a little better when I do it in a script inside player torso…
One way I’ve seen it was done on a local script (non FE) and it was instantaneous, so I wonder if I can still do the same w/ the server…
Are you serious?! I’ve been trying to fix this issue for literally MONTHS on end thinking that something was wrong with my code.
And just as I was replying above, I saw your comment. Yes, I just tested the code on my local script and it does EXACTLY what I wanted it to. This entire time there was nothing wrong with my code! AGH
Will it work server sided? That’s what I need in order to have the effect work for everyone