This part of a script is supposed to play a sound based on a player's team color. However, the script doesn't work, and output gave me nothing. Everything is defined as/located where it should be.

Can someone please help me?

Here's the script:

local player = game.Players:getPlayers()
for i = 1, #player do
	if player[i].TeamColor == BrickColor.new("Bright green") then
		player[i].Green:Play()
	elseif player[i].TeamColor == BrickColor.new("Bright red") then
		player[i].Red:Play()
	end
end

3 comments

0

Is this a localscript?

0

It is not.

0

Roblox has been updating their sound so you might wan to wait a while, or try messing around with the Min/Max Distance values they have added to see if they fix your issue.