Hi can someone answer me a simple question

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