Help With Shop Gui

So I have a problem with my shop gui, which is that if you die in-game and respawn and try to open the shop, it doesn’t open. There are no errors in ze output, and this is the code, the explorer where the gui is located, and where the local script is for opening the shop.
Local Script for opening the Shop:
local textbutton = game.Workspace.faf.SurfaceGui.TextButton
local player = game.Players.LocalPlayer
local GUI = player.PlayerGui:WaitForChild("ToolShop")
textbutton.MouseButton1Click:Connect(function()
GUI.Frame.Visible = true
end)

Here is where the part with the surface gui which opens the shop is located (The Part Containing the gui which opens the shop is named faf):
https://ibb.co/3fjM1wB

Here is where the tool shop gui is (The Tool Shop is named ToolShop):
https://ibb.co/D5Lk2QK

The local script is located in starter player scripts.

Put the GUI in StarterGui, Place the script inside the GUI.

No the surface gui is on a part which when clicked will open the toolshop, and the toolshop is In the starter gui.

After the player dies, you will need to re-reference the GUI variable because the old one is gone because of the player dying.

How would I do that, sorry I don’t know. I’m a begginer.

You can listen for a CharacterAdded event from the player and just copy everything but the player variable in there.

player.CharacterAdded:Connect(function()
    -- Your code
end)

ok im trying that.

Thanks for the solution! It works!

Be sure to click the solution button on my reply to let everyone else know.

ye I did