(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
✓ ANSWER ACCEPTED
Part (Hover, Click, Click, Colour)?
1 answer
✓ Accepted answer
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!
3 comments
0
If you're going to give someone a script for free at least explain what you're doing. Hes learning nothing and using this site for something that it wasn't intended for...
0
Alright. I'll update it to add some comments.
0
Guys! It's alright. I understand Lua very well, However I cannot apply my knowledge to when I am writing a script. That's why I find it so hard to actually write a script even though I understand clearly how scripts work.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
This is for helping you solve problems. Not solving the problem for you. I'm not giving someone who doesn't even attempt to solve it, a script on this because it's quite simple. Learn through trial and error.
Well, Where can I get a script like that then? Trial and error is too time consuming and I'm not going to go on those stupid YouTube tutorials for basics of scripting.