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

Fall animation not running and not showing any errors?

Asked by 5 years ago
Edited 5 years ago

It doesn't show any errors with the local script but only the animations do not run.

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()

repeat wait() until plr.Character.Parent == workspace.FlightModel
repeat wait()until plr.Character.Parent == workspace


mouse.KeyDown:Connect(function(key)
    key = key:lower()
    if key == "w" or key == "a" or key == "s" or key == "d" then
        plr.Character.Animate.fall.FallAnim.AnimationId = "rbxassetid://2269489808"
        while true do
            wait(.1)
            plr.Character.LowerTorso.BodyVelocity.Velocity = Vector3.new(plr.Character.Humanoid.MoveDirection.X * 100,  plr.Character.LowerTorso.BodyVelocity.Velocity.y, plr.Character.Humanoid.MoveDirection.Z * 100)
        end
    end
end)

mouse.KeyUp:Connect(function(key)
    key = key:lower()
    if key == "w" or key == "a" or key == "s" or key == "d" then
        plr.Character.Animate.fall.FallAnim.AnimationId = "rbxassetid://2230124960"
    end
end)
0
I suggest using UserInputService (https://wiki.roblox.com/index.php?title=API:Class/UserInputService) instead of KeyDown (deprecated), you're using it wrong. Axdrei 107 — 5y
0
Please post your script in a code block. User#19524 175 — 5y

1 answer

Log in to vote
0
Answered by
valchip 789 Moderation Voter
5 years ago
Edited 5 years ago

mouse.KeyUp and mouse.KeyDown are deprecated, use UserInputService

Link to article: http://wiki.roblox.com/index.php?title=API:Class/UserInputService Other articles:http://wiki.roblox.com/index.php?title=API:Class/UserInputService/InputBegan http://wiki.roblox.com/index.php?title=API:Class/UserInputService/InputChanged http://wiki.roblox.com/index.php?title=API:Class/UserInputService/InputEnded

An example how you would use InputBegan (if you are not familiar):

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.E then
        print("E")
    end
end)

I do not see anything else wrong with your script, try replacing your events with the one I showed, good luck!

(P.s I barely read your script, had no codeblock and was very messy so I assume this shall be the only mistake)

Ad

Answer this question