I wanted to make a Death Camera which looks at the player while he dies.
My issue is that the camera succesfully fix it self but doesn’t follow the HRP and I doesn’t understand why…
I have already tried to use differents CFrame settings but not working.
Here a video:
streamable video
--// Références
local GameFolder = game:GetService("ReplicatedStorage"):WaitForChild("Game", 3000)
local NetworkingFolder = GameFolder:WaitForChild("Networking", 3000)
local Interface = game:GetService('SoundService'):WaitForChild('Interface')
--// Modules
local Events = require(NetworkingFolder.Events)
--// Services
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
--// Références
local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera
--// Controls
local Controls = require(LocalPlayer:WaitForChild("PlayerScripts", 3000):WaitForChild('PlayerModule', 3000)):GetControls()
local spectating
Events.Player.onDeath_Remote.OnClientEvent:Connect(function()
local fixedPosition = Camera.CFrame.Position + Vector3.new(0, 5, -10)
--local Part = Instance.new('Part')
--Part.Name = LocalPlayer.Name
--Part.Transparency = 1
--Part.Parent = workspace.DeathsCameras
repeat Camera.CameraType = Enum.CameraType.Scriptable until Camera.CameraType == Enum.CameraType.Scriptable
--Camera.CFrame = Part.CFrame
spectating = RunService.RenderStepped:Connect(function()
local targetPos = LocalPlayer.Character.HumanoidRootPart.Position
if targetPos then
Camera.CFrame = CFrame.new(fixedPosition, targetPos)
end
end)
end)
LocalPlayer.CharacterAdded:Connect(function()
if spectating then
spectating:Disconnect()
spectating = nil
end
Camera.CameraType = Enum.CameraType.Custom
end)