Lever always moves even though its supposed to be activated by a clickdetector

So my lever always is running even though its supposed to be activated by a clickdetector and i dont know why. heres the code:

while true do
	local Pos1 = script.Parent.LeverPos1
	local Pos2 = script.Parent.LeverPos2
	local Pos3 = script.Parent.LeverPos3
	local Num1 = script.Parent.LeverPos1
	local Num2 = script.Parent.LeverPos2
	local Num3 = script.Parent.LeverPos3
	
	if Pos1.ClickDetector.MouseClick or Num1.ClickDetector.MouseClick then
		game:GetService("TweenService"):Create(script.Parent.Lever, TweenInfo.new(0.5), {Position = Vector3.new(-520.007, 655.144, 263.743)}):Play()
		script.Parent.Lever.Sound:Play()
		wait(1.2)
		game:GetService("TweenService"):Create(workspace.Values.LaserValues.CoreLaser3, TweenInfo.new(0.5), {Value = 0.7}):Play()
	end

	if Pos2.ClickDetector.MouseClick or Num2.ClickDetector.MouseClick then
		game:GetService("TweenService"):Create(script.Parent.Lever, TweenInfo.new(0.5), {Position = Vector3.new(-521.042, 655.871, 264.02)}):Play()
		script.Parent.Lever.Sound:Play()
		wait(1.2)
		game:GetService("TweenService"):Create(workspace.Values.LaserValues.CoreLaser3, TweenInfo.new(0.5), {Value = 0.4}):Play()
	end

	if Pos3.ClickDetector.MouseClick or Num3.ClickDetector.MouseClick then
		game:GetService("TweenService"):Create(script.Parent.Lever, TweenInfo.new(0.5), {Position = Vector3.new(-521.997, 656.542, 264.276)}):Play()
		script.Parent.Lever.Sound:Play()
		wait(1.2)
		game:GetService("TweenService"):Create(workspace.Values.LaserValues.CoreLaser3, TweenInfo.new(0.5), {Value = 0}):Play()
	end
	task.wait()
end

Proof of issue:


Heres the explorer view of the lever:
image

MouseClick is an event, not a property that gets set to indicate that the click detector has been clicked.

Check out Using Events | Roblox Creator Documentation

wasent helpful

char limit

^
have the script detect when one of the clickdetectors are clicked and then move the lever following that as opposed to putting it in a while loop and trying to detect clicks that way

it moves it to the top and doesnt allow any clicks

are the num variables meant to be the same as the pos variables

i realized that earlier and fixed that

i ended up rewriting the script, it works now

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.