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

why don't the brick change to its first color?

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"

2 answers

✓ Accepted answer

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)

4 comments

0

that is what i was looking for, thanks

0

use :Connect instead :connect is deprecated.

0

Just used his code, but you are right

0

Ali you should accept this answer or change title to [solved]

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.

9 comments

0

for future reference, that wouldn't qualify as spam, that would qualify as "Duplicate Question"

0

Ahh alright, thank you king.

0

i was asking another question but about the same script, please read the text fully before answering

0

I just edited my answer. I'd recommend looking into some scripting tutorials and the ROBLOX Developer forum.

0

i do actually, and practice them and sometimes i can't find the problem so i just post it here, i dont know why are you so salty about it

0

Apologies if you believe I am salty or angry with you. That is not the case, you did not specify your question at all. You posted the exact same script with one or two lines added. You also didn't see the answer. Please attempt to have more detail in your question so people can help you better in the future.

0

Also, if someone answers your question... please make sure you accept the answer for any other scripters who could have the same issue as you... they could use that information to help themselves. Thank you.

0

but i dont know how to accept an answer

0

Oh! Alright so after each post, under the comment button, there should be a little button next to the Report Button that says Accept Answer. That should help you.

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