Can anyone point out my problem in this script, for some reason it works just fine in Studio, but doesn't work in Roblox Player. The music plays fine in Roblox Player, but it doesn't check the team that you are in and still plays the music even if you are in the Bright Blue Team
debounce = false
function onTouched(Part)
if debounce == false then
local Player = game.Players:GetPlayerFromCharacter(Part.Parent)
local loud = Player.PlayerGui.ESCAPE.Frame
local Stealth = Player.PlayerGui.ESCAPE.Frame
if Player.TeamColor == BrickColor.new("Bright red") then
debounce = true
script.Parent.Alert:play()
wait(1)
Stealth.Visible = false
loud.Visible = true
script.Parent.CaughtMusic:play()
wait(60)
Stealth.Visible = true
loud.Visible = false
script.Parent.CaughtMusic:Stop()
debounce = false
else
print("hey cop")
end
end
end
script.Parent.Touched:connect(onTouched)
