How would I make this Camera-Script follow the Torso again after the player dies?
Currently it works when the player has not died yet, but when I reset, the camera stays in it's place, and I can freely move my player again too! (Which is not supposed to happen because of the BodyPositioner)
So, my question is, how would I kind of "reset" everything (The camera and the BodyPositioner) back to how they were before the player reset? (So that the Camera is following the Torso of the player, and that the BodyPositioner works again?)
I have tried everything from rebuilding the script to adding more code, but nothing seems to help!
Here is the coding, it is in a LocalScript in StarterPlayerScripts:
local Camera = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer
repeat
wait()
until Player.Character
local Character = Player.Character
local Player_Torso = Character.Torso
local BodyPositioner = Instance.new("BodyPosition", Player_Torso)
BodyPositioner.MaxForce = Vector3.new(0, 0, math.huge)
BodyPositioner.Position = Vector3.new(0, 0,Player_Torso.Position.Z)
-------------------------------------------------------------------
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = Player_Torso
game:GetService("RunService").RenderStepped:connect(function()
Camera.CFrame = CFrame.new(Player_Torso.CFrame.X, Player_Torso.CFrame.Y, Player_Torso.CFrame.Z + 30)
Camera.FieldOfView = 80
end)

1 comment
Do Player.CharacterAdded:Wait() to wait for character to spawn.