Ill make it simple: I want to make the character play a certain walking animation when going forward and another when going backwards, this is what i've tried so far:
local Player = game:GetService("Players").LocalPlayer local Character = Player.Character local Humanoid = Character.Humanoid local Camera = workspace.CurrentCamera local Result = Camera.CFrame:VectorToObjectSpace(Humanoid.MoveDirection) while true do wait(1) print(Result) --This prints 0,0,0 every 1 second- Doesnt work. end
Anything that helps me reach my goal would be appreciated, thanks.
I would change the defaut walk animation everytime you press S (or your custom key).
local UIS = game:GetService("UserInputService") local animateScript = character:WaitForChild("Animate") -- Change the defaut walk animation: animateScript.walk.WalkAnim.AnimationId = "rbxassetid://CustomAnimationForwards" -- Walk Backwards animation when pressing S: UIS.InputBegan:Connect(function(key) if key.KeyCode == Enum.KeyCode.S then animateScript.walk.WalkAnim.AnimationId = "rbxassetid://CustomAnimationBackWards" end end end) -- Reset Forward animation when release S: UIS.InputEnded:Connect(function(key) if key.KeyCode == Enum.KeyCode.S then animateScript.walk.WalkAnim.AnimationId = "rbxassetid://CustomAnimationForWards" end end end)