How to not make a script reset when a player dies?

Okay, I know the answer is probably obvious to most, but I looked everywhere and couldn’t find what I was looking for.

I am trying to make a play, credits, donate screen when you first join the game, however the screen starts every time you die.

This is the script inside the play button:

local cam = game.Workspace.Camera
script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Enabled = false
	cam.CameraType = Enum.CameraType.Custom
end)

This is the script inside of starterGui:

local cam = game.Workspace.Camera

wait(0.1)

cam.CameraType = Enum.CameraType.Scriptable

cam.CFrame = game.Workspace.joincam.CFrame

And in case you need it, this is the script inside the credits button:

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.creditsframe.Visible = true
end)

Thanks for any help! (The camera also goes to the part every time you die too!)

You should enable the GUI every time the character gets added, which you can do, using CharacterAdded

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        -- this event will fire whenver the player respawns aswell as when the player joins the game
    end)
end)
1 Like

Set the ResetOnSpawn of the GUI to false.

5 Likes

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