How to deal with Motors6D after Disconnecting

Just look at this video:
robloxapp-20201021-2041588.wmv (2.8 MB)
as u can see when I disconnect from the function waist doesn’t go to its original orientation.
Here is my code:

local waist = plr.Character:FindFirstChild("Waist", true)
local defPos = waist.C0
local equiped = false

local function renderStepped()
	if equiped == false then
		waist.C0 = defPos
		render:Disconnect()
	end 
	local dif = (root.CFrame.p - ms.Hit.p) 
	local look = (root.CFrame.upVector)
	local angle = math.acos((dif:Dot(look) / dif.Magnitude * look.Magnitude))
	waist.C0 = defPos * cf.Angles(angle - math.pi / 2, 0, 0)
end
local remoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("GunGiver")
remoteEvent.OnClientEvent:Connect(function(value)
	equiped = value
	if value == true then
		render = game:GetService("RunService").RenderStepped:Connect(renderStepped)
	end
end)

Should I change it to defPos every frame? Anyways thanks for the help!

1 Like

after render:Disconnect(), put a return

oh thanks I understand now, it worked