Camera stays on dead point

When I die and respawn in studio my camera works fine and theres no issues. But when I try in-game my camera gets stuck on the last place where I died. I’ve looking through several posts and none of those work.

Any Idea why is happening and how to solve it? Thanks

1 Like

Could you please provide the code that is causing these issues?

1 Like

I dont have idea. Since the console doesnt give me any errors and in studio everything works fine Im trying to find a script that modifies the camera. If I found any I will send it

2 Likes

I found this welcome screen script when I removed it everything worked properly.

local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
local PlayButton = script.Parent.PlayButton
local Title = script.Parent.Title
local SubTitle = script.Parent.SubTitle
local WeaponGui = Player.PlayerGui:WaitForChild("WeaponGui")
local StaminaGui = Player.PlayerGui:WaitForChild("StaminaGui")
local HealthGui = Player.PlayerGui:WaitForChild("HealthGui")

repeat wait()
	Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.CameraPart.CFrame

PlayButton.MouseButton1Click:Connect(function()
	WeaponGui.Enabled = true
	StaminaGui.Enabled = true
	HealthGui.Enabled = true
	Camera.CameraType = Enum.CameraType.Custom
	PlayButton:Destroy()
	Title:Destroy()
	SubTitle:Destroy()
end)

Yes, that is because when you respawn, the script runs again, setting the camera’s position to the position of the CameraPart. If your script is inside a ScreenGui, I would recommend you set the ResetOnSpawn property of the ScreenGui to false.

2 Likes

But I made on click the Play button it shows every other guis. If I set the reset on respawn to false the guis would be invisible again. And if I make them also not to reset on spawn some of them would broke

Then just check if the player has never died before setting the cameras position

Any example? Im not on my pc rn

local Character = game.Players.LocalPlayer or game.Players.LocalPlayer.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

Humanoid.Died:Connect(function()
game.ReplicatedStorage.DeathCount += 1
end)

if game.ReplicatedStorage.DeathCount <= 0 then

--Player has not died (yet)

end
1 Like

Im guessing this is LocalScript but where should I place it?

1 Like

You should just place this event anywhere where a local script can run, and the if statement in the welcome screen script

1 Like

And whats DeathCount Supposted to be?

An Integer value inside of Replicated Storage (int value)

Instead of that I just added when the camera cframe is put on the CameraPart also disable the guis

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.