How To Set Cam Back To Default

Hello there, I am using this script where my camera follows my mouse however I want to set it back to default on mouseclick in a button I made. Here is my script -

1 Like

So set the camera type to custom on click on that button.

1 Like

Doesn’t work however I’m not getting any errors.

1 Like

Bring the camera type back to custom then add a debounce/disabler for the renderstepped maybe

Example:

if Default == true then return end
1 Like

Didn’t work still. Is there anything else I can do?

1 Like

what was the need of looping cameratype to Scriptable tho?

1 Like

Because sometimes it wouldn’t run so I looped it until It was Scriptable.

Is the issue the camera not following your character?

1 Like

Basically, the script right now is a script to make the camera slightly move with the players mouse however when they click a button, I would like it to set it back to the original.

Here is my disabler script -

local cam = workspace.CurrentCamera

script.Parent.MouseButton1Click:Connect(function()
cam.CameraType = Enum.CameraType.Custom
end)

1 Like

Try This

local Cam = game.Workspace.CurrentCamera
local CamPart = game.Workspace["CameraPart"]
local Mouse = game.Players.LocalPlayer:GetMouse()

Cam.CameraType = Enum.CameraType.Scriptable


local MaxTilt = 10
local Dis = false
game:GetService("RunService").RenderStepped:Connect(function()
	if Dis == false then
		Cam.CFrame = CamPart.CFrame * CFrame.Angles(
			math.rad(((Mouse.Y - Mouse.ViewSizeY / 2) / Mouse.ViewSizeY) * -MaxTilt),
			math.rad(((Mouse.X - Mouse.ViewSizeX / 2) / Mouse.ViewSizeX) * -MaxTilt),
			0
		)
	end
end)


script.Parent.MouseButton1Click:Connect(function()
	Dis = true
	Cam.CameraType = Enum.CameraType.Custom
	Cam.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
end)
4 Likes

Wow this works really well! Thank you so much I could not be any happier!!

2 Likes