I have a part which as a fire effect, so far I have it that when you click it the fire will be enabled. I don't how to make it when I click it again the fire will be disabled.
Current Script -
local fire = script.Parent.Fire script.Parent.ClickDetector.MouseClick:Connect(function(plr) fire.Enabled = true end)
Currently it's very simple but I have no clue how to go about adding to it.
try this
local fire = script.Parent.Fire script.Parent.ClickDetector.MouseClick:Connect(function(plr) if fire.Enabled == false then fire.Enabled = true else if fire.Enabled = true then fire.Enabled = false end end end)
You could do like a debounce. So, what it'll do is it'll detect if the condition is true, if it is then Enable the fire, but enabling it will make the condition go 'false', so if you click it again it will not pass the condition, but another if statement that checks whether the condition is false will disable the fire. In this case the fire can be the debounce. A bit confused? Let me give you an example.
local fire = script.Parent.Fire script.Parent.ClickDetector.MouseClick:Connect(function(plr) if fire.Enabled == false then fire.Enabled = true elseif fire.Enabled == true fire.Enabled = false end end)