Playing an animation on all players in a server at the same time

Hi, I am trying to play an animation on all players inside a server at the same time.

for i, v in pairs(game.Workspace:GetDescendants()) do
	if v.Name == "Humanoid" then
		local hum = v	
		
		local Hold = hum:LoadAnimation(script.BruceHold)
		Hold:Play()
		
	end
end

I tried this method and have no errors printing, yet the script will still not work. Any help or guidance would be greatly appreciated!

Maybe use game.Players:GetPlayers() except game.Workspace:GetDescendants()

Ah thank you, Iā€™m having an error that is printing this:
image

I am assuming the

for i, v in pairs(game.Workspace:GetDescendants()) do

is where my error is, as it is now printing that in the output with both

 game.Workspace:GetDescendants()

and

game.Players:GetPlayers()

You can write this instead:

for i, v in pairs(game.Players:GetChildren()) do
	local char = v.Character
	local hum = char:WaitForChild("Humanoid")

	-- hum:LoadAnimation here
end

You should use an Animator to load the animation instead of the Humanoid.

for i, plr in pairs(game.Players:GetPlayers()) do
	plr.Character:FindFirstChild("Humanoid").Animator:LoadAnimation(script.BruceHold):Play()
end
2 Likes

Thank you for all the help, it just seems to never play the animation. Unsure what is causing this, no errors are being printed either.

I am currently testing it using the code @PosFind posted.

The source of my issue was completely on my side, I had forgot that the animation was R15 and not R6. Once I loaded it into a new game, the R15 animation of course would not play on an R6 rig.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.