Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[SOLVED] Animations not replicating at all?

Asked by
ozzyDrive 670 Moderation Voter
6 years ago
Edited 6 years ago

These animations play perfectly fine on the client playing them but they don't play at all for the server nor any other client as can be seen in this gif. Everything should be set up correctly but in case I'm missing something, here's the character's hierarchy. The character has its network owner set to the correct player and works great otherwise.

Here's the only relevant piece of code on the server which initializes the character:

local function initCharacter(model)
    local humanoidObject = script.humanoidObject:Clone()
    humanoidObject.Name = "Humanoid"
    humanoidObject.Parent = model

    humanoidObject.AnimationPlayed:Connect(function(track)
        --    This event never fires
        print(track.Animation.Name)
    end)

    script.jumpVelocity:Clone().Parent = model.PrimaryPart

    local gyro = script.bodyGyro:Clone()
    gyro.CFrame = CFrame.Angles(0, math.rad(180), 0)
    gyro.Parent = model.PrimaryPart

    model.Parent = workspace
end

And here's the function to play the animations, on the client:

function Character:playAnimation(name)
    local track = self:continueTrack(name)
    if not track then   
        local humanoidObject = self.model.Humanoid      
        track = humanoidObject:LoadAnimation(self.animations[name])

        self.animationTracks[name] = track
        track:Play()        
    end
    return track
end

Again, works great on the client. Character.animations points to a folder containing all the animation objects. This folder is inside StarterPlayerScripts (so the client clones them inside the PlayerScripts folder) thus they only exist on the client. I first thought this may have been the issue and threw the animations folder inside ReplicatedStorage but the issue still persisted.

1 answer

Log in to vote
0
Answered by
ozzyDrive 670 Moderation Voter
6 years ago

Found the solution. It was another thing I did not see being mentioned in the wiki, at all. The Humanoid requires an "Animator" object inside it.

Ad

Answer this question