I am currently working on making a GUI reappear when a player dies and it works perfectly the first time. The second time it works fine except when I tell it to return the camera type to custom, it does make it custom but the camera isn't connected to the player. Any ideas?
Example of what I'm talking about
Script:
game.ReplicatedStorage.RemoteEvents.PlayButton.OnClientEvent:Connect(function()
local backpack = game.Players.LocalPlayer.Backpack
local looky = game.Workspace.CurrentCamera
if backpack:FindFirstChild("Holy Lightning Blade") then
storage.RemoteEvents.MobileOn:FireServer()
script.Parent.Visible = false
repeat wait()
looky.CameraType = Enum.CameraType.Custom
until looky.CameraType == Enum.CameraType.Custom
elseif backpack:FindFirstChild("Metal Blade") then
storage.RemoteEvents.MobileOn:FireServer()
script.Parent.Visible = false
repeat wait()
looky.CameraType = Enum.CameraType.Custom
until looky.CameraType == Enum.CameraType.Custom
elseif backpack:FindFirstChild("Starter Blade") then
storage.RemoteEvents.MobileOn:FireServer()
script.Parent.Visible = false
repeat wait()
looky.CameraType = Enum.CameraType.Custom
until looky.CameraType == Enum.CameraType.Custom
elseif backpack:FindFirstChild("Starter Sword") then
storage.RemoteEvents.MobileOn:FireServer()
script.Parent.Visible = false
repeat wait()
looky.CameraType = Enum.CameraType.Custom
until looky.CameraType == Enum.CameraType.Custom
elseif backpack:FindFirstChild("Steel Sword") then
storage.RemoteEvents.MobileOn:FireServer()
script.Parent.Visible = false
repeat wait()
looky.CameraType = Enum.CameraType.Custom
until looky.CameraType == Enum.CameraType.Custom
elseif backpack:FindFirstChild("Sword") then
storage.RemoteEvents.MobileOn:FireServer()
script.Parent.Visible = false
repeat wait()
looky.CameraType = Enum.CameraType.Custom
until looky.CameraType == Enum.CameraType.Custom
elseif backpack:FindFirstChild("Sword Of Light") then
storage.RemoteEvents.MobileOn:FireServer()
script.Parent.Visible = false
repeat wait()
looky.CameraType = Enum.CameraType.Custom
until looky.CameraType == Enum.CameraType.Custom
elseif backpack:FindFirstChild("Wooden Sword") then
storage.RemoteEvents.MobileOn:FireServer()
script.Parent.Visible = false
repeat wait()
looky.CameraType = Enum.CameraType.Custom
until looky.CameraType == Enum.CameraType.Custom
else
script.Parent.Parent.NoSword.Position = UDim2.new(0.321, 0,0.321, 0)
end
end)
(The script broke when I pasted it)

3 comments
I don't see where you're setting the camera type back to the default one for it to lock onto the character
Look inside one of the elseif blocks, it should be towards the end where it says repeat wait()
I couldn't remember if Roblox used Custom or a different camera type for attaching to the player. Set the CameraSubject to the player's humanoid in their character