Camera focus when respawned

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to achieve that whenever the character respawns, the camera changes back to the menu

Menu:

into game:

respawn:

  1. What is the issue? Include screenshots / videos if possible!
    So whenever I spawn, the camera focuses on the map for example. and whenever you die and respawn, the thing doesnt work again.

  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried adding the character added/loaded event thing and it still didnt work. I know the problem but idk how to do add the character added/characterloaded thing. I tried but it didnt work. no errors, just doesnt work

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-wait(5)

local camera = workspace.CurrentCamera
local focuspart = game.Workspace.CameraFocus
local endpart = workspace.RealFocus
local Player = game:GetService("Players").LocalPlayer
local plr = game.Players.LocalPlayer
local code = script

print ("Camera Change script running")
camera.CameraType = "Scriptable"
camera:Interpolate(focuspart.CFrame, endpart.CFrame, 0.01)

(ignore variables)
(local script in starterplayer scripts)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Make sure the code is in a local script and is placed in a StarterCharacterScripts. This will make it so everytime you die and respawn that script runs.

2 Likes
local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local focuspart = workspace.CameraFocus
local endpart = workspace.RealFocus
local cameraType = Enum.CameraType.Scriptable

repeat
	task.wait()
	camera.CameraType = cameraType
until camera.CameraType == cameraType

camera:Interpolate(focuspart.CFrame, endpart.CFrame, 0.01)

As has been suggested, if you want a script to execute each time the player’s character spawns/reloads then you should place the script inside the StarterCharacterScripts folder. I’ve also made a few minor changes to the script itself.