I have this script to run pumps but after it runs the first time and tries to turn it on again it gives this message: "12:18:03.658 - Workspace.Pumps.Clickyboi.Script:8: attempt to index upvalue 'isiton' (a boolean value)" I have tried numerous times to try to fix this issue but it just keeps appearing.

local access = script.Parent.Parent
local pump1 = access.Pump1.Housing
local pump2 = access.Pump2.Housing
local isiton = true
local canbeactivated = true

script.Parent.ClickDetector.MouseClick:connect(function(TRIGGERED)
	if isiton.Value == false and canbeactivated == true
		then isiton = true
		canbeactivated = false
		pump1.On:Play()
		wait(3)
		pump2.On:Play()
		wait(3)
		pump1.Running:Play()
		wait(3)
		pump2.Running:Play()
		wait(3)
		canbeactivated = true	
		end
end)

script.Parent.ClickDetector.MouseClick:connect(function(LOL)
		if isiton.Value == true and canbeactivated == true then
		isiton = false
		pump1.Shutdown:Play()
		pump2.Shutdown:Play()
		pump1.Running:Stop()
		pump2.Running:Stop()
		wait(10)
		canbeactivated = true			end
end)

2 comments

0

Line 4 you set the variable on like 8 you use isiton.Value which is a boolean value

0

thanks, that fixed it