I'm working with an NPC and am trying to enable/disable some billboard guis when it walks in certain directions. Nothing happens when I try this with the npc but it does work when I try this with the player
local camera = game.Workspace.CurrentCamera local humanoid = script.Parent:FindFirstChild("Humanoid") local pb1 = game.Workspace.Dummy:WaitForChild("Bag").pb1 local pb2 = game.Workspace.Dummy:WaitForChild("Bag").pb2 function Test(disabled) if (humanoid.MoveDirection:Dot(camera.CFrame.RightVector) > 0) then --when the npc runs upwards or to the right, pb2 is no longer visible and pb1 becomes visible. pb1.Enabled = true pb2.Enabled = false elseif (humanoid.MoveDirection:Dot(camera.CFrame.RightVector) < 0) then ----when the npc runs downwards or left, pb1 is no longer visible and pb2 becomes visible. pb1.Enabled = false pb2.Enabled = true end end humanoid.Running:Connect(Test)
(not sure if this method is for the player's humanoid only)
Use Humanoid.RootPart.AssemblyLinearVelocity.Unit
or something. It'll get the relative unit to 1 stud.