Animation not playing on server

My animation isn’t loading on the server although I think it should. Basically how it works is that the morphs have the default r6 animation script in them, but that doesn’t show on the server for some reason. If anyone can give me any recommendations eg. a better way to morph characters or a way to make the animations show on the server, please do so.

function loadCharacter(plr, data)
    plr:LoadCharacter()
    local char = plr.Character
    local newchar = chars[data]:Clone()
    newchar:SetPrimaryPartCFrame(char.PrimaryPart.CFrame)
    newchar.Name = plr.Name
    plr.Character = newchar
    newchar.Parent = workspace
    plr.Race.Value = newchar.Name
end

image

2 Likes

Hey,

You are missing the ‘Animator’ Instance inside of Humanoid which is responsible for replicating animations played on the client to the server. You must create that instance on the server.

You can find more info about this class here: Animator

How would I do that, considering that I just use the default animate script, not a specific animation?

You can simply do that using Instance.new().

Example code:

-- SERVER SCRIPT
local characterModel = yourcharactermodelhere; -- variable containing the character model (in your case, the r6 morph)
local hum = characterModel:FindFirstChild("Humanoid"); -- we look for humanoid inside the morph and assign it to the hum variable

Instance.new("Animator", hum) -- We call Instance.new(), first argument being the Animator instance you need in order to replicate locally played animations to server, second argument being the humanoid so the Animator instance is put inside the Humanoid

Once an Animator is present inside the Humanoid, any locally played animation on that character model will replicate to the Server without any issues!

I hope this is of help!

1 Like

I have recorded a short clip to demonstrate how the Animator instance functions, it will help you understand its purpose.

https://developer.roblox.com/en-us/api-reference/class/Animator

NPC animations should be loaded and played on the server (via a server script). You should be able to copy the default ‘Animate’ script’s contents into a server script (and it’ll still work).