Hi can someone answer me a simple question

I would recommend you not to direct spoon feed, without any explaining or any links to the API Reference. It doesn’t really help the OP learn, instead please try to explain what the code does or instead of the Code, you can help them understand the mechanism instead.

1 Like

Yes, i tottally agree with that, i just don’t think this is too complicated, as being a simple question i can understand just by the full script.

1 Like

So answering to your question, what you basically wanna do is do something like below example:

if x is true then you do function a, else if x is false then you do function b, This is the logic that you can use and basically code something like what you want.

1 Like

Jamesplough explains it to the basics so read his reply but if u wanna know how to do it with click detector then this is for myself and probably you too

code

this is from theherogamer’s code and ill try to explain so this is also for me too because I kinda forget how to use the clickdetector and ill bookmark this thread for myself

local clicked = false -- put variable as if you not clicked then false 

script.Parent.Clicked:Connect(function() -- This is going to fire a function by using the Clicked event from the Clickdetector
    if clicked == false then -- If clicked and this variable is still as "not clicked"
        clicked = true -- then change it to true to know its "Clicked"
        script.Parent.Parent.BrickColor = BrickColor.new() ––red -- If the clicked Is true then the part should change its color to red

    else -- if you click again then dont make it always red so else do green
    clicked = false -- changing back the Clicked to not Clicked
    script.Parent.Parent.BrickColor = BrickColor.new() –—green -- change to color green
end
1 Like

Sry, not good at explaining… and I typed the code on mobile so… yea mobile coding is not my favourite thing

2 Likes