I am trying to make a prison game, but i can’t seem to play a animation on my group. Basically, what i’m trying to do, is play a animation but the entire group can see, but i’m just a moderator of the group, not the owner. Aka, trying to make the animation play for the entire group instead of only me. (Also, it only works on studio it doesn’t work on the actual roblox)
Also, the reason i’m posting this on the scripting support, it’s because this is the most popular category, so that’s why i’m posting here.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PlayGroupAnimation = ReplicatedStorage:WaitForChild("PlayGroupAnimation")
-- Function to trigger animation for all players in the group --
local function triggerAnimationForGroup(groupId, animationId)
for _, player in pairs(game.Players:GetPlayers()) do
if player:IsInGroup(groupId) then
PlayGroupAnimation:FireClient(player, animationId)
end
end
end
-- Example: triggering the animation with a command (adjust as needed for your game) --
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if msg == "!playAnimation" then
local groupId = 123456 -- Replace with your actual group ID --
local animationId = "rbxassetid://1234567890" -- Replace with your actual animation ID --
triggerAnimationForGroup(groupId, animationId)
end
end)
end)
Make a localscript inside of StarterPlayerScripts
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PlayGroupAnimation = ReplicatedStorage:WaitForChild("PlayGroupAnimation")
PlayGroupAnimation.OnClientEvent:Connect(function(animationId)
local character = game.Players.LocalPlayer.Character
if character then
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
local animator = humanoid:FindFirstChildOfClass("Animator")
if not animator then
animator = Instance.new("Animator")
animator.Parent = humanoid
end
local animation = Instance.new("Animation")
animation.AnimationId = animationId
local animationTrack = animator:LoadAnimation(animation)
animationTrack:Play()
end
end
end)
That’s… not what i mean, i’m bad at explaining but i’m gonna try to explain again, for some reason, when the owner of the group publishes a animation, it normally would work for him, but not for the other people, BUT it would work for the entire game too, but, the friend i’m with doesn’t know how to publish animations (and i’m lazy to teach him) but in other words, i want to everyone can see the animation, but when I publish, nobody can see my animation, only myself, it doesn’t even apply to the whole game.
Roblox likes to double-check animations that are uploaded to their website, so it usually takes a while till it applies for everyone, I’ve had that multiple times, but the only thing you need to do is wait.
Well, the button says: “Solved” sooo, i’m just gonna see if it works, i’m gonna try to wait, if it works, i’m marking you as solution, BUT, i’m generous so i’m gonna give you a solution
ok so you have to publish the animation under the group. that’s why it’s not showing up for others. i’m not the owner of a group, however in the studio, i can publish the animation, and it shows up for others.