i made a checkpoint system and it works fine altho when im setting the character CFrame after the player has died it does not rotate the camera with it
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Stage = Instance.new("IntValue")
Stage.Parent = leaderstats
Stage.Value = 1
Stage.Name = "Stage"
player.CharacterAdded:Connect(function(character)
wait()
character.HumanoidRootPart.CFrame = workspace.Checkpoints:FindFirstChild(tostring(Stage.Value)).CFrame * CFrame.new(0,3,0)
end)
end)
for i,v in pairs(workspace.Checkpoints:GetChildren()) do
v.Touched:Connect(function(hit)
if hit.Parent:IsA("Model") and hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if v.Name == tostring(player.leaderstats:WaitForChild("Stage").Value + 1) then
v.Color = Color3.new(0, 1, 1)
player.leaderstats.Stage.Value += 1
end
end
end
end)
end
local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
game.ReplicatedStorage.RotateCamera.OnClientEvent:Connect(function()
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame *= CFrame.Angles(math.rad(90),0,0)
camera.CameraType = Enum.CameraType.Custom
end)
this is the local script
its putting the camera below the player