Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How come my music playing Touched script isn't working?

Asked by 8 years ago

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.

01debounce = false
02 
03function onTouched(hit)
04 
05    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
06 
07    if player then
08 
09        if player.TeamColor == ("Bright red") then
10 
11            if debounce == false then
12 
13    debounce = true
14 
15    script.Parent.Alert:play()
View all 29 lines...

2 answers

Log in to vote
1
Answered by 8 years ago

If I am correct, your error is on line 9. TeamColor is a BrickColor value, meaning you have to use BrickColor.new("Bright red"), not just ("Bright red").

I hope I was right, haha! Good luck.

Ad
Log in to vote
-1
Answered by 8 years ago

"Bright Red" Isn't a team color its a BrickColor

Answer this question