I am trying to make a moving lever handle for a building game I’m making, but I don’t know how to do it. It needs to be able to work with it being anchored and unanchored.
I tried using motor6Ds but it just makes the handle fall when unanchored.
I want to also make it tween for realistic movement.
Example (Build A Boat For Treasure)
This might be using hinge constraints but I don’t know how to use those without the part falling.
easiest solution to this is just to add 2 invisible parts for cframe reference and just tween the lever between them based on the state (off/on)
reference image: transparent parts are invisible parts for positioning, red part is lever itself (ofcourse you want to set the lever at either on or off and not at center as i show here)
local TweenService = game:GetService("TweenService")
local part = whatever
function ChangeState(state)
local pickedCFrame = nil
if state == "on" then
pickedCFrame = part.OnCframe.CFrame
else
pickedCFrame = part.OffCframe.CFrame
end
TweenService:Create(part, tweeninfo, {CFrame = pickedCFrame}):Play()
end
Alr, I did some testing and I am able to change the position of the handle by using a normal weld and changing its C0 property. Still trying to get the positions right though
Heres what I have so far. (I don’t really know how welds work)
I set the C0 which moves the part and doesnt fall when unanchored.
I don’t know how to make it go to the exact positions of the point A and B parts.