Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

my script for my coolant Button will not Work/Continue can someone help?

my script wont work for a game that i am making, the script is for a button and i will put the script i put here:

script.Parent.mouseClickconnect[function()
	script.Parent.Parent.BrickColor = BrickColor.new("Really red")
	workspace.CoolantSmoke["Smoke"].Disabled = true
end
wait(3)

script.Parent.mouseClickconnect[function()
	script.Parent.Parent.BrickColor = BrickColor.new("Sea green")
workspace.CoolantSmoke["Smoke"].Disabled = false

1 answer

-- Index static variables
local Part = script.Parent.Parent
local Smoke = workspace.CoolandSmoke['Smoke']
local ClickDetector = script.Parent
local ButtonEnabled = true
Smoke.Enabled = false

-- Open anonymous function with parenthesis, not brackets
-- Methods have ':' > :Clone(), :Destroy(), etc..
-- Use Connect, connect is deprecated
ClickDetector.MouseClick:Connect(function()
	-- Enabled, not Disabled. 
	if not Smoke.Enabled then 
		Smoke.Enabled = true
		Part.BrickColor = BrickColor.new("Really red")
		wait(3)
		-- Allow button to be clicked again
		Smoke.Enabled = false
		Part.BrickColor = BrickColor.new("Sea green")
	end
end) -- close anonymous function

This discussion is preserved as it was. New answers, comments, and votes are closed.