Hello, so I have a set of animations that are played through by various local scripts (ex. a tool, running animation, etc.) and I was wondering about why they weren’t being shown through other players.
I also additionally used a custom character (it’s just the same avatar but with a mushroom head)
I have tried doing many methods to solve this problem like creating the animations INSIDE of the character instead of just being made by the local script but the local script loads the animation (animationTrack) but it still hasn’t worked for some reason.
I think it’s quite strange why it doesn’t play the animation even though animations are global to everyone. If you would like a script, here are two scripts that I have used some of the animations on.
script 1 (the animation giver):
local Scrooms = game.ReplicatedStorage.ScroomRandomizer
game.Players.CharacterAutoLoads = false
game.Players.PlayerAdded:Connect(function(player)
local ScroomsFolder = Scrooms:GetChildren()
local ChosenScroom = ScroomsFolder[math.random(1,#ScroomsFolder)]
local character = ChosenScroom:Clone()
character.Name = player.Name
player.Character = character
character.Parent = workspace
local ScroomDecomposeDown = Instance.new("Animation")
ScroomDecomposeDown.Parent = character
ScroomDecomposeDown.Name = "ScroomDecomposeDown"
ScroomDecomposeDown.AnimationId = "rbxassetid://5700277977"
local ScroomDecomposeUp = Instance.new("Animation")
ScroomDecomposeUp.Parent = character
ScroomDecomposeUp.Name = "ScroomDecomposeUp"
ScroomDecomposeUp.AnimationId = "rbxassetid://5700288886"
local RunAnimation = Instance.new("Animation")
RunAnimation.Parent = character
RunAnimation.AnimationId = "rbxassetid://5703067458"
RunAnimation.Name = "RunAnimation"
local MineAnimation = Instance.new("Animation")
MineAnimation.Parent = character
MineAnimation.AnimationId = "rbxassetid://5702911825"
MineAnimation.Name = "MineAnimation"
end)
script 2 (a tool animation):
local tool = script.Parent
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local MineAnimation = character:WaitForChild("MineAnimation")
local animationTrack = humanoid:LoadAnimation(MineAnimation)
tool.Activated:Connect(function()
if not animationTrack.IsPlaying then
local AnimationTracks = humanoid:GetPlayingAnimationTracks()
animationTrack:Play()
end
end)
They won’t, due to LocalScripts only running for the client rather for the server. You’d probably want to use RemoteEvent to notify the server, then play the animation on that player.
yes like I said earlier but in one of my codes the animation does play in a local script and is shown to every one. Though I think his animation is a core then action. Or since its running and stuff make the animation under movement
Like they set animation priority. Say if you played two animations at once with one set to Action and the other set to Core. The one set to Action would take priority and play
Hi, I had a very similar problem to this and i was confused as heck, but it turns out if you load your own characters, you also have to handle some other stuff, like building an animator.
Here’s what we run for loading a custom character, and it works with a local animation script:
function CharacterLoader:LoadNewCharacterAtLocation(CharacterModel,newVector)
print("Loading character for " .. self.Player.Name)
local character = CharacterModel:Clone()
character.Name = self.Player.Name
self:DestroyCharacter()
self.Player.Character = character
local Animator = Instance.new("Animator")
Animator.Parent = character.Humanoid
character.Parent = workspace
character.PrimaryPart:SetNetworkOwner(self.Player)
character.PrimaryPart.CFrame = CFrame.new(newVector)
end
As you can see, we also create an Animator, and set some network ownership. I don’t know if it’s necessary to set network ownership or not, but I do it because it’s a logical step in the process of creating a custom character.
This is actually incorrect; animations that are played within the humanoid are replicated to all clients and not only the current player. The issue to this is more than likely because the humanoid doesn’t have an Animator. But I am pretty certain :LoadAnimation() creates an Animator automatically if there already isn’t one, which is quite unusual.
Hey I had the same problem and I just used a RemoteEvent to run it on the server but it wasn’t showing on the client-side so I did the same.
Soo it looks like this for my personal code
Serverside
game.ReplicatedStorage.Animations.Animate.OnServerEvent:Connect(function(plr)
local Humanoid = plr.Character.Humanoid
local Anims = game.ReplicatedStorage.Animations
local PortArmsTrack = Humanoid:LoadAnimation(Anims.PortArms)
local AimingTrack = Humanoid:LoadAnimation(Anims.Aiming)
PortArmsTrack.Priority = Enum.AnimationPriority.Action
AimingTrack.Priority = Enum.AnimationPriority.Action
PortArmsTrack:Play()
end)
Client Side
local player = game.Players.LocalPlayer
local Event
script.Parent.Equipped:Connect(function()
local Anims = game.ReplicatedStorage.Animations
local char = player.Character or player.CharacterAdded:Wait()
local Humanoid = char:WaitForChild('Humanoid')
Anims.Animate:FireServer()
local PortArmsTrack = Humanoid:LoadAnimation(Anims.PortArms)
local AimingTrack = Humanoid:LoadAnimation(Anims.Aiming)
PortArmsTrack.Priority = Enum.AnimationPriority.Action
AimingTrack.Priority = Enum.AnimationPriority.Action
PortArmsTrack:Play()
end)