Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

0 Why won't my sound that is each character play when activated by the game script?

I have a world script that activates a sound object in each character but it seems to not be working. Any thoughts?

for i = 4, 1, -1 do
		UniversalText.Value = "Commencing in: " .. i
		for i, v in pairs(Players) do
			if v.Ingame.Value == true then
			v.Character.Boing1:Play()
			end
		end
		wait(1)
	end

1 answer

Well first of. What you did was to iterate through the whole table of players in the players service. I'll share a code and explain it.

--Script in some service in workspace or ServerScriptService
local players=game:GetService("Players"):GetPlayers();
for _,player in ipairs(players) do
	if(player.Character~=nil) then
		player.Character:FindFirstChild("UpperTorso"):FindFirstChild("Boing1"):Play()
	end
end
--The sound needs to have a parent that's a 3D object (Such as a brick in game)
--If your game is R6. Instead of "UpperTorso". Replace it with "Torso"
--So what we do here is to get all players to a table.
--Loop them through and then check if the character is loaded using if(...) then
--And if it isn't nil. Then find the UpperTorso and then find the audio Boing1 and play it

1 comment

0

Darn, that didn't work either.

This discussion is preserved as it was. New answers, comments, and votes are closed.