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:

01local function initCharacter(model)
02    local humanoidObject = script.humanoidObject:Clone()
03    humanoidObject.Name = "Humanoid"
04    humanoidObject.Parent = model
05 
06    humanoidObject.AnimationPlayed:Connect(function(track)
07        --    This event never fires
08        print(track.Animation.Name)
09    end)
10 
11    script.jumpVelocity:Clone().Parent = model.PrimaryPart
12 
13    local gyro = script.bodyGyro:Clone()
14    gyro.CFrame = CFrame.Angles(0, math.rad(180), 0)
15    gyro.Parent = model.PrimaryPart
16 
17    model.Parent = workspace
18end

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

01function Character:playAnimation(name)
02    local track = self:continueTrack(name)
03    if not track then  
04        local humanoidObject = self.model.Humanoid     
05        track = humanoidObject:LoadAnimation(self.animations[name])
06 
07        self.animationTracks[name] = track
08        track:Play()       
09    end
10    return track
11end

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