#Animation Stutter
1 messages · Page 1 of 1 (latest)
** You are now Level 2! **
Send your script
local tool = script.Parent
local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
local RPS = game:GetService("ReplicatedStorage")
local animator = humanoid:FindFirstChild("Animator")
local idleAnim = RPS.Animations.Idle
local walkAnim = RPS.Animations.Walk
local idleTrack = animator:LoadAnimation(idleAnim)
local walkTrack = animator:LoadAnimation(walkAnim)
idleTrack.Priority = 0
walkTrack.Priority = 1
local equipped = false
tool.Equipped:Connect(function()
print("tool equipped")
equipped = true
idleTrack:Play()
UIS.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
local anim = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.M1)
anim:Play()
elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
local anim = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.M2)
anim:Play()
elseif input.KeyCode == Enum.KeyCode.LeftControl then
local anim = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Crouch)
anim:Play()
elseif input.KeyCode == Enum.KeyCode.F then
local anim = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Block)
anim:Play()
elseif input.KeyCode == Enum.KeyCode.Space then
local anim = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Jump)
anim:Play()
end
end)
end)
tool.Unequipped:Connect(function()
print("tool unequipped")
equipped = false
idleTrack:Stop()
end)
humanoid.Running:Connect(function(speed)
if equipped == true and speed > 0 then
walkTrack:Play()
end
if speed == 0 then
walkTrack:Stop()
end
end)
Don't load the animations everytime the player moves.
What would I do then?
Load the animations only once
Oh I see thanks
Load the animation every time the humanoid loads