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

A very interesting question? [closed]

Asked by 5 years ago

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
0
I'm not sure why you are checking if MouseButton1Click exists, as it is an event theking48989987 2147 — 5y

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?

1 answer

Log in to vote
0
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
5 years ago

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.

0
nope I did this too and it failed n1ksutin123 3 — 5y
0
local selected = script.Parent.Parent.selected.Value local basecolor = Color3.fromRGB(177, 177, 177) if script.Parent.name.MouseButton1Click and selected == nil then wait() selected = script.Parent selected.BackgroundColor3 = Color3.fromRGB(177, 177, 233) elseif script.Parent.name.MouseButton1Click then selected.BackgroundColor3 = basecolor wait() selected.BackgroundColor3 = Color3.fromRG n1ksutin123 3 — 5y
Ad