When I press a button I want it to stop (RunService.Stepped) before doing this you press a button, it makes the camera look at an object and it's working correctly! But if i want the camera to go back to normal, i need to stop Run.Service.Stepped, I Cannot Find anyway of stopping it so far.
function UpdateCam()
local CFam = CFrame.new(script.Parent.Parent.Character.PrimaryPart.CFrame.Position,
workspace.Dummy.PrimaryPart.CFrame.Position)
local CamCFam = CFam*CFrame.new(0, 3, 0)
print(CamCFam)
workspace.CurrentCamera.CFrame = CamCFam
end
UIS.InputBegan:Connect(function(input, gameProcessedEvent)
if input.KeyCode == Enum.KeyCode.L then
if LisOn == false then
LisOn = true
RunService.Stepped:Connect(UpdateCam)
print("camera changed new")
elseif LisOn == true then
LisOn = false
RunService.Stepped:Disconnect(UpdateCam) -- I want it to be here but this won't work
print("camera changed old")
end
end
end)

3 comments
I tried replacing the RunService.Stepped:Disconnect(UpdateCam) into script.parent:destroy() just to test it, it stops the runservice, but if i'm walking and break the script, the walking sound won't stop. And I can't do the same script obviously because i deleted it. still need help!
Try removing the UpdateCam on disconnect so it should be like RunService.Stepped:Disconnect()
I'm not sure whether that will work