How come my music playing Touched script isn't working?
For some reason, whenever I run my script, nothing shows up in the output or the dev console.
I wanted to make my script run when a player from a specific team touches a brick. If I remove the lines relating to "player", the script works fine, but without team detecting capabilities.
03 | function onTouched(hit) |
05 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
09 | if player.TeamColor = = ( "Bright red" ) then |
11 | if debounce = = false then |
15 | script.Parent.Alert:play() |
17 | script.Parent.CaughtMusic:play() |
19 | script.Parent.CaughtMusic:Stop() |
23 | print ( "k m8 you are a cop, ill let u free" ) |
29 | script.Parent.Touched:connect(onTouched) |