I have tried many scripts, but none of them work. Im not that good at making scripts so help would be nice!
COMMUNITY QUESTION
How do I make it so when you press a button it toggles a part to change color?
2 answers
There are three things I’m assuming:
- the button is a clickable UI object
- you clearly aren’t familiar with remote events
- you also aren’t familiar with this sites rules.
Never the less, I’ll still help you lol..
- create a remote event
- fire the remote event from the client when the button is pressed
- listen to the fire on the server and change the parts color from there
There are two simple ways of doing this.
This code changes color if the button and part are inside a model.
model = script.Parent
model.Button.ClickDetector.MouseClick:Connect(function()
model.ColorPart.BrickColor = BrickColor.new("Lime green")
end)
This code changes color if the part is somewhere in workspace.
part = workspace:FindFirstChild("ColorPart")
button = script.Parent
button.ClickDetector.MouseClick:Connect(function()
part.BrickColor = BrickColor.new("Lime green")
end)
I hope this answers your question! If you are experiencing any problems, comment back. This was actually one of my first successful scripts I've made back in 2017 lol
1 comment
0
Thanks, it helped a lot!
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Unless you want to do it locally.
You could if you didn’t want it to replicate.