Animation Loops in Studio but not in Game?

I made a walking animation for some “animals.” The animation work completely fine in studio. They loop when the animals move and they stop playing when they have reached their destination (which is random). However, when I actually play the game on roblox, the animations don’t loop like they do in studio? Does anyone know why?

I own all animations, models, etc.

How it looks in studio

How it looks in game

Forgot to paste the code I made, here it is:

local humanoid = script.Parent
local walkAnimation = script:WaitForChild(“WalkAnimation”)
local walking = humanoid:LoadAnimation(walkAnimation)

local function randomPosition()
local randomPositionPicker = Vector3.new((math.random(-20,20)), 3.5, (math.random(-20, 20)))
walking.Looped = true
walking:Play()
humanoid:MoveTo(randomPositionPicker)
print(randomPositionPicker)
humanoid.MoveToFinished:Wait()
walking:Stop()

end

while wait(math.random(5, 8)) do
randomPosition()
end

What is the animation priority and is animation set to loop by default?

What is the animal’s network ownership status?

it was set to movement because its a walking animation. I looked it up and it said that walking amimations should be set as “movement”. however, im not really sure. Also yes, ive set it to loop by default.

not sure what you mean by this or what that is exactly?

Okay then try setting the Set Network Owner to nil.

local animal = script.Parent--your animal goes here
animal:SetNetworkOwner(nil)--this will make it so that the animation is handled by the server (must be the root part like HumanoidRootPart)

Edit: If it’s a model then you can set it’s primary part’s network ownership.

The Set Network Owner method makes it so that anything like physics is handled by either a client or the server. You can make it so that the client is the owner which is useful for stuff like vehicles to prevent lag on the server. But in your case setting the network ownership to server which is nil will play the animation to all.

1 Like

This is what i added to my script.
humanoid.Parent.HumanoidRootPart:SetNetworkOwner(nil)

It doesn’t seem to be working.
humanoid.Parent.HumanoidRootPart is referencing the rootpart of the animal, which is also the primary part for the model. Did I type it wrong?

I reuploaded the animation, making sure that the “looped” property was set to true. This seems to have fixed the issue.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.