Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My camera doesnt go back to the player when being set to "custom"?

Hi there, i have this game that has a menu when you spawn in, in this menu the camera is changed to a different area and once you press play it should go back to the player. Ive even done this task many times before but for some reason the camera isnt going back to normal

below shows the important stuff you need to know in the script

--//Player Var
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local cam = workspace.CurrentCamera

--//Service Var
local rep = game:GetService("ReplicatedStorage")
local ts = game:GetService("TweenService")

--//Gui Var
local gui = script.Parent
local blackScreen = gui.BlackScreen
local logo = gui.Frame.Logo
local logoText = gui.Frame.Logo
local menu = false
local running = false

--//Other
local camPart = workspace.CamPart1
local camPos1 = workspace.CamPos1
local camPos2 = workspace.CamPos2

player.CharacterAdded:Connect(function()
	menu = true
	cam.CameraType = Enum.CameraType.Scriptable
	cam.CFrame = camPart.CFrame
	rep.Music.Menu:Stop()
	rep.Music.Menu:Play()
	wait(3)
	for i = 1,100 do
		wait()
		blackScreen.BackgroundTransparency = blackScreen.BackgroundTransparency + 0.01
	end
end)

gui.Frame.PlayButton.MouseButton1Click:Connect(function()
	--camTween1:Cancel()
	menu = false
	cam.CameraType = Enum.CameraType.Custom
end)

1 answer

✓ Accepted answer

Basically, all you gotta do is set the currentcamera to the player's character model.

local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid

This is the code to set the camera back to the character.

1 comment

0

thank you, i tried something extremely similar to this and it didnt work at all which lead to me being confused

This discussion is preserved as it was. New answers, comments, and votes are closed.