Make an animation play on the server for everyone else, but not the player on the client

I want an animation to play on the server for the player, but make the player not see it on the client.

I don’t know if this is possible.

I can’t find any topic on this.

I’d just like an idea on how this could be achieved.

local plr = game.Players.LocalPlayer

for i,v in pairs(game.Players:GetPlayers()) do
    if v ~= plr then
        --your stuff here
    end
end
1 Like

Yes but I want the player to play the animation but not see it, only others would see it

You’d have every other client load an animation onto that client’s character’s humanoid’s animator. Here’s the pseudo-code to achieve this.

--SERVER
RemoteEvent:FireAllClients(Player) --Fire every client with the player that you want to play the animation.

--CLIENT
local function OnRemoteFired(Player)
	if Player == LocalPlayer then return end --Return out of the function if the player of the client (local player) matches the player that you want to the play the animation.
	local Character = Player.Character
	if not Character then return end
	local Humanoid = Character:FindFirstChildOfClass("Humanoid")
	if not Humanoid then return end
	local Animator = Humanoid:FindFirstChildOfClass("Animator")
	if not Animator then return end
	local Animation = Instance.new("Animation")
	Animation.AnimationId = "rbxassetid:0" --Change '0' to the desired animation's ID.
	local Track = Animator:LoadAnimation(Animation)
	--Set track's priority if necessary.
	Track:Play()
end

Remote.OnClientEvent:Connect(OnRemoteFired)
1 Like