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

i need help with this movement and animation, can anyone help?

Asked by 4 years ago

hello today I created an animation where the player makes a frontflip to avoid things and therefore I made a script to move the player but the player goes to one side and does not follow the player's view here the code

local player = game.Players.LocalPlayer
repeat wait() until player.Character.Humanoid
local humanoid = player.Character.Humanoid
local mouse = player:GetMouse()
local pos = player.Character.HumanoidRootPart
local cam = workspace.CurrentCamera


local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/asset/?id=4582289516"

mouse.KeyDown:connect(function(key)
    if key == "z" then
        local playAnim = humanoid:LoadAnimation(anim)
        playAnim:Play()
        local AnimationTracks = humanoid:GetPlayingAnimationTracks()
         for i = 1,100 
          pos.CFrame = pos.CFrame + Vector3.new(0,0,0.1)

          wait(0.01)
        end
    end
end)

help

0
You should use body velocities instead, it’s way easier MmadProgrammer 35 — 4y
0
try doing pos.CFrame = pos.CFrame + cam.CFrame.LookVector*Vector3.new(0.1, 0, 0.1) kisty1 111 — 4y

Answer this question