Question: What object must be used for this? -

local TLB = P.Bottom.Power.Lever

(and its children and/or parents)

Here's the script associated with it (and its children) for it to function:

TLB.MouseMoved:connect(function(screenX, screenY)
	if (leftButtonDown) then
		local oldY = TLB.Lever.Position.Y.Offset + 10
		local newY = math.ceil((screenY - TLB.AbsolutePosition.y - 36) / 10)
		newY = math.max( math.min( 8, newY), 0)
		if ((newY * 10) ~= oldY) then P.Click:Play() end
		TLB.Lever.Position = UDim2.new(0, 0, 0, newY * 10 - 10)
		local ratio = 1 - (newY / 8)
		throttle = ratio
	end
end)

I'm not too sure of how this script is supposed to function, but based on my observation, when the mouse is left clicked then the "lever" will move up or down, please correct me if I'm wrong.

2 comments

0

GUIObject.MouseMoved, and you never defined leftButtonDown

0

@theCJarmy7 what do you mean by "GUIObject.MouseMoved" and yes, leftButtonDown is defined, it is just not show as this is just the relevant (for the question) snippet of an entire script