So I want to make it so that different music plays depending on different teams. Here is my script.
local EuropeanTheme = game.ServerStorage:WaitForChild("Fantasy Life- Theme of Fantasy Life") local AmericanTheme = game.ServerStorage:WaitForChild("Fantasy Life - Theme of intrigue") game.Players.PlayerAdded:Connect(function(Player) if Player.TeamColor == "Crimson" then AmericanTheme.Playing = true end if Player.TeamColor == "Bright blue" then EuropeanTheme.Playing = true end end)
I have no clue if this works, or not but here is what I edited/errors:
Music Playing Error:
-- on line 6 and 9: AmericanTheme.Playing = true -- is incorrect -- use this instead: AmericanTheme:Play() -- also make sure the audio properties is looped. (Looped = true)
Team Dectating Error:
if Player.TeamColor = "blah" then -- will not work -- Use This Instead: modelname = "bjh" if game.Players:playerFromCharacter(Player).TeamColor==game.Teams:findFirstChild(modelname).TeamColor then -- It works better and allows a easy to edit team name.
Final Code:
modelname = "Blah" -- put the american team name here. modelnameB = "Blah2" -- put the european team name here. local EuropeanTheme = game.ServerStorage:WaitForChild("Fantasy Life- Theme of Fantasy Life") local AmericanTheme = game.ServerStorage:WaitForChild("Fantasy Life - Theme of intrigue") game.Players.PlayerAdded:Connect(function(Player) if game.Players:playerFromCharacter(Player).TeamColor==game.Teams:findFirstChild(modelname).TeamColor then AmericanTheme:Play() end if game.Players:playerFromCharacter(Player).TeamColor==game.Teams:findFirstChild(modelnameB).TeamColor then EuropeanTheme:Play() end end)
Enjoy, and if this works please accept.
I have no idea if this works, but try it.
modelname = "SomethingTeam" modelnameB = "OtherTeam" local EuropeanTheme = game.ServerStorage:WaitForChild("Fantasy Life- Theme of Fantasy Life") local AmericanTheme = game.ServerStorage:WaitForChild("Fantasy Life - Theme of intrigue") game.Players.PlayerAdded:Connect(function(Player) wait(.1) if game.Players:FindFirstChild(Player.Name).TeamColor == BrickColor.new("the color") then AmericanTheme:Play() end if game.Players:FindFirstChild(Player.Name).TeamColor == BrickColor.new("the color") then EuropeanTheme:Play() end end)