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?