(I do not know how to script at all, I need this script though) How would I do a script for when I hover over a part it changes to a certain color (Light Yellow) and then when I click on the part it changes to a certain color (Dark Yellow) Then when I click on it again and it's the Dark Yellow it then goes back to its original color and repeats the process of the Light Yellow > Dark Yellow > Original Color. Light Yellow (Hover) > Dark Yellow (Click) > Original Color (Click and checks if the color of the brick is Dark Yellow so that it can return to it's original color) ALSO, When you hover over it and then you all of a sudden don't hover over it, it turns back to its original color
part = game.Workspace.Part oldColor = part.BrickColor mouse = game.Players.LocalPlayer:GetMouse() yellow = BrickColor.new("New Yeller") darkYellow = BrickColor.new("Br. yellowish orange") mouse.Button1Down:Connect(function() if mouse.Target == part then -- Checking if the mouse is hovering over the part after clicking it if part.BrickColor == darkYellow then -- Check if the part's color is dark-yellow, if so, change it back to the original color part.BrickColor = oldColor elseif part.BrickColor == yellow then -- check if the part is yellow, if so, change it to dark yellow. part.BrickColor = darkYellow end end end) debounce = false mouse.Move:Connect(function() if mouse.Target == part then -- Check if the mouse is hovering over the part if part.BrickColor == oldColor and not debounce then -- checking if the part is the original color, and checking if the mouse was off the part so it doesn't instantly change back to yellow. part.BrickColor = yellow end debounce = true else if part.BrickColor == yellow then --Checking if the part is yellow before changing it back to it's original color, so it doesn't change if it is orange. part.BrickColor = oldColor end debounce = false end end)
There you go. Hopefully this will teach you a thing or two about scripting. Enjoy!
Closed as Not Constructive by cmgtotalyawesome, CaptainAlien132, Lugical, SuperSamyGamer, namespace25, and Fragmentation123
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?