So I made a button that was supposed to revert the object's color back to the original color, and also remove any fire instances from the object. The thing is, the button works, but only when you click it the first time. It changes the color, but only deletes the fire instance once, after that it doesn't work.
This is the script:
local tweenBall = workspace.TweenButton.Part
local detectBallColor = tweenBall.Parent.DetectPartColor
local fire = tweenBall:WaitForChild("Fire")
local button = script.Parent
local isClicked = nil
local isChanged = nil
button.ClickDetector.MouseClick:Connect(function(player)
if not isClicked then
isClicked = true
if fire or tweenBall.Color ~= detectBallColor.Color then
if not isChanged then
isChanged = true
fire:Destroy()
print("Fire destroyed")
tweenBall.Color = detectBallColor.Color
print("Color changed")
wait(3)
isClicked = false
isChanged = false
else
isClicked = true
end
end
end
end)
I tried changing some things, but it doesn't work
Any help would be appreciated
