how to make when i press run or play the game the lever will be on the top currently its down
local ScriptFolder = script.Parent
local SwitchModel = ScriptFolder.Parent
local Switch = SwitchModel.Switch
local SwitchDrag = Switch.DragDetector
local HingePart = SwitchModel.Hinge
local HingeConstraint = HingePart.HingeConstraint
Switch:SetAttribute("isOn", false)
local State = Switch:GetAttribute("isOn")
local WeldConstraint = HingePart.WeldConstraint
SwitchDrag.DragStart:Connect(function()
WeldConstraint.Enabled = false
State = Switch:GetAttribute("isOn")
end)
SwitchDrag.DragEnd:Connect(function()
WeldConstraint.Enabled = true
end)
SwitchDrag.DragContinue:Connect(function()
local angle = HingeConstraint.CurrentAngle
if angle >= 65 or angle <= -65 then
if State == (angle > 0) then
Switch:SetAttribute("isOn", angle < 0)
WeldConstraint.Enabled = true
SwitchDrag.Enabled = true
task.delay(1, function()
SwitchDrag.Enabled = true
end)
end
end
end)