Basically, im playing animations in a local script in startercharacterscripts and it plays fine on client but not on server. I tried a default roblox dance animation id and it works on both client and server so its not a script issue. I have full access to the animation. I tried putting the animation back into animation editor and change its priority there but then the animation plays on the server but not the client.I’ve also tried playing the animation on a server script and it doesnt work .Any help would be greatly appreciated. Thanks
could we see ur script pls, that might help
local equipAnimId = "rbxassetid://111375786346158"
local unequipAnimId = "rbxassetid://88612827625019"
local shootAnimId = "rbxassetid://84381008482863"
local idleAnimId = "rbxassetid://99113786022478"
local walkAnimId = "rbxassetid://99113786022478"
local function onToolEquipped(tool)
if not tool:FindFirstChild("Speed") or not tool:FindFirstChild("Cooldown") then
return
end
currentTool = tool
canShoot = true
local humanoid = character:FindFirstChild("Humanoid")
if humanoid then
EUEvent:FireServer(true, tool)
local animator = humanoid:WaitForChild("Animator")
local animation = Instance.new("Animation")
animation.AnimationId = equipAnimId
animation.Parent = animator
equipTrack = animator:LoadAnimation(animation)
equipTrack.Priority = Enum.AnimationPriority.Action
local shootAnimation = Instance.new("Animation")
shootAnimation.AnimationId = shootAnimId
shootAnimation.Parent = animator
shootTrack = animator:LoadAnimation(shootAnimation)
shootTrack.Priority = Enum.AnimationPriority.Action3
local unequipAnimation = Instance.new("Animation")
unequipAnimation.AnimationId = unequipAnimId
unequipAnimation.Parent = animator
unequipTrack = animator:LoadAnimation(unequipAnimation)
unequipTrack.Priority = Enum.AnimationPriority.Action
local idleAnimation = Instance.new("Animation")
idleAnimation.AnimationId = idleAnimId
idleAnimation.Parent = animator
idleTrack = animator:LoadAnimation(idleAnimation)
idleTrack.Priority = Enum.AnimationPriority.Idle
idleTrack.Looped = true
local walkAnimation = Instance.new("Animation")
walkAnimation.AnimationId = walkAnimId
walkAnimation.Parent = animator
walkTrack = animator:LoadAnimation(walkAnimation)
walkTrack.Priority = Enum.AnimationPriority.Movement
walkTrack.Looped = true
equipTrack:Play()
equipTrack.Stopped:Connect(function()
if idleTrack then
idleTrack:Play(0.25)
end
end)
humanoid.Running:Connect(function(speed)
if speed > 0 then
if idleTrack and idleTrack.IsPlaying then
idleTrack:Stop()
end
if walkTrack and not walkTrack.IsPlaying then
walkTrack:Play(0.25)
end
else
if walkTrack and walkTrack.IsPlaying then
walkTrack:Stop(0.25)
end
if idleTrack and not idleTrack.IsPlaying then
idleTrack:Play(0.25)
end
end
end)
end
local success, result = pcall(function()
return game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 1635798283)
end)
hasCooldownPass = success and result or false
tool.Activated:Connect(function()
shootGun(tool)
end)
end
local function onToolUnequipped(tool)
if unequipTrack then
unequipTrack:Play()
end
EUEvent:FireServer(false, tool)
currentTool = nil
canShoot = false
hasCooldownPass = false
isAiming = false
if walkTrack then
walkTrack:Stop()
walkTrack = nil
end
if idleTrack then
idleTrack:Stop()
idleTrack = nil
end
if equipTrack then
equipTrack:Stop()
equipTrack = nil
end
if shootTrack then
shootTrack:Stop()
shootTrack = nil
end
if unequipTrack then
unequipTrack = nil
end
end
snippet
I’m sorry but I’m so confused if the animation is being played in a local script of course you can’t see it on the server because animations don’t replicate to the server, if you want every player to see the animation you can use a remote event firing the FireAllClients function and then play the animation.
If you play an animation on your client, it won’t play on the server.
If you are trying to play an animation for all clients, either play it from the server directly or send a RemoteEvent to all clients like this:
Server:
local rs = game:GetService("ReplicatedStorage")
local remotes = rs:WaitForChild("Remotes")
local animateRemote = remotes:WaitForChild("Animate")
local function animate(player, animationId)
animateRemote:FireAllClients(player, animationId)
end
-- Example Usage:
local ANIMATION_ID = "rbxassetid://YOUR_ANIMATION_ID"
game.Players.PlayerAdded:Connect(function(plr)
local char = plr.Character or plr.CharacterAdded:Wait()
animate(plr, ANIMATION_ID)
end)
Client:
local rs = game:GetService("ReplicatedStorage")
local remotes = rs:WaitForChild("Remotes")
local animateRemote = remotes:WaitForChild("Animate")
animateRemote.OnClientEvent:Connect(function(targetPlayer, animId)
local character = targetPlayer.Character or targetPlayer.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid") :: Humanoid
local animator = humanoid:FindFirstChild("Animator") or Instance.new("Animator", humanoid)
local anim = Instance.new("Animation")
anim.AnimationId = animId
local track = animator:LoadAnimation(anim)
track:AdjustSpeed(1) -- Here you can adjust playback speed
track:Play()
end)
Oh that’s weird i swr they replicated. Mb I’ll try the given solution
I am very certain that animations played through the Animator do replicate to the server normally, even in Server Authority they do. As soon as you delete the animate script on your client side, the animations will all stop, even on the server.
Ye because I tried it with a default dance animation and it replicated to server and I was using the same script
Unfortunately I’m not sure what the issue is but it’s not because of the local script. Best I’d recommend is placing prints to check all over the script to see if everything is working
Oh sorry, my mind was out of date on the animation controller instance my mind thought it was the same as humanoid:Load animation(), well at least I know now.