Hello guys ! I have a problem with my rig, my animation work but it is really weird
here is my code if someone know how to fix this I’ll appreciate it (I tested on a dummy without this whole script just with humanoid:MoveTo
and animator:LoadAnimation()
and that worked perfectly)
local PetManager = {}
local function FollowPlr(plr, unit)
print(plr, unit)
local Part1 = plr.Character:FindFirstChild("Part1")
local Part2 = plr.Character:FindFirstChild("Part2")
local Part3 = plr.Character:FindFirstChild("Part3")
local Humanoid :Humanoid = unit:FindFirstChild(unit:GetAttribute("name")).Model:FindFirstChild(unit:GetAttribute("name")).Humanoid
local PlrHumanoid = plr.Character:FindFirstChild("Humanoid")
local AnimationTrack = Humanoid.Animator:LoadAnimation(script.WalkAnim)
PlrHumanoid.Running:Connect(function(speed)
if speed > 0 then
if AnimationTrack.IsPlaying == true then return end
AnimationTrack:Play()
else
AnimationTrack:Stop()
end
end)
while task.wait(0.01) do
Humanoid:MoveTo(Part1.Position)
end
end
function PetManager.CreatePet(plr :Player, uuid)
local char :Model= workspace:FindFirstChild(plr.Name)
local UnitCloned :Folder = plr.Units:FindFirstChild(uuid):Clone()
UnitCloned.Parent = workspace.PetsFolder
UnitCloned:FindFirstChild(UnitCloned:GetAttribute("name")).Model:FindFirstChild(UnitCloned:GetAttribute("name")):SetPrimaryPartCFrame(char.Part1.CFrame)
FollowPlr(plr, UnitCloned)
end
function PetManager.RemovePet(plr, uuid)
end
return PetManager