Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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.

debounce = false

function onTouched(hit)
	
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	
	if player then

		if player.TeamColor == ("Bright red") then

			if debounce == false then

	debounce = true

	script.Parent.Alert:play()
	wait(1)
	script.Parent.CaughtMusic:play()
	wait(60)
	script.Parent.CaughtMusic:Stop()
    
    debounce = false	
			else
				print("k m8 you are a cop, ill let u free")
	
end	
end		
end

script.Parent.Touched:connect(onTouched)
		

2 answers

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.