This is a very interesting problem cause the problem line isn't working and it doesn't give a error it automatically changes the color and the selected object value isn't even the button. I would appreciate any help.
local selected = script.Parent.Parent.selected.Value local basecolor = Color3.fromRGB(177, 177, 177) if script.Parent.name.MouseButton1Click and selected == nil then -- the problem is this if and then wait() selected = script.Parent selected.BackgroundColor3 = Color3.fromRGB(177, 177, 233) else selected.BackgroundColor3 = basecolor wait() selected = nil selected.BackgroundColor3 = Color3.fromRGB(177, 177, 233) end
On line 21, you set your variable to nil and then try to set the backgroundColor3 to it on line 23. Simply don't set it to nil, or change your variable names if they're conflicting.
Closed as Non-Descriptive by evaera
This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.
Why was this question closed?