so im new at scripting and im trying to do the basics
so i tried to make a script that when anything touches it, it changes its color and it worked fine but when i tried to make it change to its first color i couldn't
function onTouch() script.Parent.BrickColor = BrickColor.new("Bright green") end script.Parent.Touched:connect(onTouch) wait (1) script.Parent.BrickColor = BrickColor.new("Deep orange")
"the brick's first color is Deep orange"
If you want it to change back after 1 sec just put it inside the function
function onTouch() script.Parent.BrickColor = BrickColor.new("Bright green") wait(1) script.Parent.BrickColor = BrickColor.new("Deep orange") end script.Parent.Touched:connect(onTouch)
Sir, your question was answered already and you haven't used the script that was given by the person who took the time to help you. With this, you don't have a Humanoid linking your entire script together plus you'd need a if statement to register it. I'll post this again but please reward the other person on your last question to help them out as well. With this, if you used this, you'd be able to figure out how you can make it so it changes color on each touch. You are also spamming. That's kind of breaking the rules. Just informing you.
function onTouched(otherPart) if otherPart.Parent:FindFirstChild("Humanoid") then script.Parent.BrickColor = BrickColor.new("Bright green") end end --Made By IceAndNull
The link to the post he answered.. I would recommend looking into people such as AlvinBlox for scripting tutorials to understand this stuff.