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
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
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.
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
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