Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What do I do now that the 'Strafing' event doesn't work?

Asked by 7 years ago

I need to determine the direction a player is moving. Normally I've been able to do this by using the Strafing event in the humanoid, but it no longer works. So what I've been doing to determine the player's movement direction is creating a part that shows where the player is going (for visual purposes) and I figured I'd try to create a Vector3 that shows where the part is in relation to the player (i.e 0, 0, -2 for forward or 2, 0, 0 for strafing, if that's what the result would be).

Below is what I have for the visual representation.

local runservice = game:GetService("RunService")
local player = game.Players.LocalPlayer
local character = script.Parent
local humanoid = character.Humanoid

local part = Instance.new("Part")
part.Color = Color3.fromRGB(0, 255, 0)
part.Transparency = .5
part.Material = "Neon"
part.Anchored = true
part.CanCollide = false
part.Parent = character
part.Size = Vector3.new(2, .1, 2)

runservice.RenderStepped:connect(function()
    local md = humanoid.MoveDirection * 2
    part.CFrame = CFrame.new(character.HumanoidRootPart.Position, character.HumanoidRootPart.Position + md) * CFrame.new(0, -2, -2)
end)

Right now I'm having trouble with finding a solution that shows the difference in direction. Does anyone have any suggestions or something I should look at?

0
You can use the "Velocity" property of the part "HumanoidRootPart"(Or LowerTorso, not sure) to check a character's speed. I didn't tried, but I think It would be fine. If it works I'll answer on comments Aimarekin 345 — 7y
0
I meant I'll answer on answers Aimarekin 345 — 7y
0
I'm running into the same problem with that, I'm afraid. Thank you though RichardHoss 2 — 7y
0
Why do you need anything more than humanoid.MoveDirection? cabbler 1942 — 7y
0
Because after two days of trying I have yet to come up with anything that determines whether the player is moving "Right", "Left", "Forward", or "Backwards" RichardHoss 2 — 7y

Answer this question