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

I'm trying to get it so when the click detector is pressed a part would go red any help?

Asked by 4 years ago

So, I'm trying to figure out a code to change the color of my part Color1 but it's not working I'm making a game and I take the testing very seriously because without a working game it will get dislikes. And I've trying to make this script for about a day now.

Heres my script:

script.Parent.ClickDetector.MouseClick:connect(function()
 script.Parent.Color1.BrickColor = BrickColor.Red()
end)

I know it's not a lot but it's one of the main parts of my game.

Any help will be appreciated.

0
ServerScript. Ziffixture 6913 — 4y
0
Make it a LocalScript then use a RemoteEvent. MinecraftButterfly87 10 — 4y
0
Make sure that it's a server script. firespear500 12 — 4y
0
K. charlesec 36 — 4y
0
I'm confused look at the chat. charlesec 36 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

Change the script to this:

function onClicked()
    script.Parent.BrickColor = BrickColor.Red()
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

Tell me if your confused

Ad

Answer this question