Deactivate this camera script

So, this camera script is a custom one.

Things script uses:

  1. a folder in replicatedstorage named CameraObject with the camera part
  2. a folder in workspace where the camera part gets transfered when the script is activated which is named CameraFolder

Its basically a dungeon crawler camera, and I want to deactivate it using another script, how would I do this?

The script is below which activates the camera for the dungeon crawler camera:

local player = game.Players.LocalPlayer

local character = player.Character or player.CharacterAdded:Wait()
local rootPart = character:WaitForChild('HumanoidRootPart')
local camera = workspace.Camera
local folder = workspace.CameraFolder
local part = game.ReplicatedStorage.CameraObject.CameraPart

camera.CameraType = Enum.CameraType.Scriptable

local cameraPart = part:Clone()
cameraPart.Parent = folder

camera.CameraSubject = cameraPart

cameraPart.Position = rootPart.Position + Vector3.new(20,25,20)
camera.CFrame = cameraPart.CFrame + Vector3.new(-1,1,-1)

game["Run Service"].Heartbeat:Connect(function()
        cameraPart.Position = rootPart.Position + Vector3.new(20,25,20)
        camera.CFrame = camera.CFrame:Lerp(cameraPart.CFrame + Vector3.new(-1,1,-1), 0.5)
end)

If you want to de-activate it through another script, the easy way would be to just disable the script or do it through modular code and put it inside of a function.

2 Likes

I already tried to disable the script, but It didnt work.

Do you want it permanently disabled or toggleable in game?

I want it permanently disabled.

If you want to keep the code you could just select it all and comment it out (or disable it but like you said that’s not working for whatever reason)
otherwise, just delete the script

So I would simply delete the script?

I mean if you never use it in game then sure,
alternatively if you want to do it from a separate script while in the game then just use the Remove() function

Ill try it out, ill let you know if anything was fixed.

1 Like

Nevermind! Disabling the script worked, for some reason last time it didn’t work, Thank you!

1 Like