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

1 comment

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.