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

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

Asked by
Ali_MTR 30
4 years ago

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

Log in to vote
1
Answered by
karlo_tr10 1233 Moderation Voter
4 years ago

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)

0
that is what i was looking for, thanks Ali_MTR 30 — 4y
0
use :Connect instead :connect is deprecated. marioman1932 48 — 4y
0
Just used his code, but you are right karlo_tr10 1233 — 4y
0
Ali you should accept this answer or change title to [solved] karlo_tr10 1233 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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.

0
for future reference, that wouldn't qualify as spam, that would qualify as "Duplicate Question" theking48989987 2147 — 4y
0
Ahh alright, thank you king. Just2Terrify 566 — 4y
0
i was asking another question but about the same script, please read the text fully before answering Ali_MTR 30 — 4y
0
I just edited my answer. I'd recommend looking into some scripting tutorials and the ROBLOX Developer forum. Just2Terrify 566 — 4y
View all comments (5 more)
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 Ali_MTR 30 — 4y
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. Just2Terrify 566 — 4y
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. Just2Terrify 566 — 4y
0
but i dont know how to accept an answer Ali_MTR 30 — 4y
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. Just2Terrify 566 — 4y

Answer this question