Hey everyone! Need some help, I’m trying to make it so once the lever reaches a specific angle it does a function, how do I achieve this?
script.Parent.DragDetector.DragContinue:Connect(function()
local object = script.Parent.PrimaryPart
local _, pitch, _ = object.CFrame:ToOrientation()
local pitchInDegrees = math.deg(pitch)
if pitchInDegrees == 89.95331133131195 then
print("Successfully dragged!")
end
end)
i never used dragdetectors so i dont really know how they function but maybe try to check the orientation of the lever and when it reaches a certain value it does the function?
maybe something like:
if object.Orientation.X == 89.95 then
print("Dragged")
end
Think of it this way; a door in medieval games; when you pull down the lever entirely the door opens, that’s what im trying to go for; im making it so once it reaches to the angle; it does a function.