Hi guys, my animation works however when I move my character the roblox walking animation plays aswell and they both combine to make a weird animation. How do I fix this?
Here is the weird behaviour in action.
Testing area - Roblox Studio - Gyazo
wait(1)
local frame=script.Parent
local user=game.Players.LocalPlayer
repeat wait() until user.Character local char = user.Character
local humanoid = char:WaitForChild("Humanoid")
local anim
function playanim(id)
if char~=nil and humanoid~=nil then
local id="rbxassetid://"..tostring(id)
local oldanim=char:FindFirstChild("LocalAnimation")
if anim~=nil then
anim:Stop()
end
if oldanim~=nil then
if oldanim.AnimationId==id then
oldanim:Destroy()
return
end
oldanim:Destroy()
end
local animation=Instance.new("Animation",char)
animation.Name="LocalAnimation"
animation.AnimationId=id
anim=humanoid:LoadAnimation(animation)
anim:Play()
end
end
local b1=frame.Dance1
b1.MouseButton1Down:connect(function() playanim(b1.AnimID.Value) end)
local b2=frame.Dance2
b2.MouseButton1Down:connect(function() playanim(b2.AnimID.Value) end)
local b3=frame.Dance3
b3.MouseButton1Down:connect(function() playanim(b3.AnimID.Value) end)
local b4=frame.Dance4
b4.MouseButton1Down:connect(function() playanim(b4.AnimID.Value) end)
local b5=frame.Dance5
b5.MouseButton1Down:connect(function() playanim(b5.AnimID.Value) end)
local b6=frame.Dance6
b6.MouseButton1Down:connect(function() playanim(b6.AnimID.Value) end)
Here is the animation script