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

How to make a First Person Walk and Sprint Gun Animation? ( f i r s t p e r s o n ) [closed]

Asked by 2 years ago
Edited 2 years ago

So, i'm weirdly retarded or i just forgot how to do this, but whether im decently new to lua coding and i'm trying to play an animation for a gun in firstperson, not a tool. yes, its not a tool. the code

local UIS = game:GetService('UserInputService')
local Player = game.Players.LocalPlayer
local Character = Player.Character
local viewmodel = game.ReplicatedStorage.as_val_animations.Walk
local walk = game.StarterPlayer.StarterPlayerScripts.LocalHandler
local ReplicatedStorage = game:GetService("ReplicatedStorage")

UIS.InputBegan:connect(function(input)
    if input.KeyCode == Enum.KeyCode.LeftShift then
        Character.Humanoid.WalkSpeed = 23
        local Anim = Instance.new('Animation')
        Anim.AnimationId = 'rbxassetid://' 
        PlayAnim = viewmodel.AnimationController:LoadAnimation()
        PlayAnim:Play()
    end
end)

UIS.InputEnded:connect(function(input)
        Character.Humanoid.WalkSpeed = 13
        PlayAnim:Stop()
        local Anim = Instance.new('Animation')
        Anim.AnimationId ='rbxassetid://7251566677'
        PlayAnim = viewmodel.AnimationController:LoadAnimation(walk)
        PlayAnim:Play(walk)

end)

local function Moved()
    if Character.Humanoid.MoveDirection.magnitude > 0 then
        Character.Humanoid.WalkSpeed = 13
        PlayAnim:Stop()


    else
        print("Stopped Moving")
    end
end

i have no idea what i did wrong because yes the first lines of what i said

0
When asking/answering a question, please encase your code in Lua tags (Look for the Lua icon in the editor). I have done it for you this time. appxritixn 2235 — 2y

Closed as Non-Descriptive by JesseSong

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?