This code is used for cloning a GUI into the player if the player does not have it already, and also opens the GUI. It will clone the GUI into the player the first time they come into contact with the block but after they die, if they touch the block again it will not clone the GUI.
script.Parent.Touched:connect(function(p) local player = game.Players:GetPlayerFromCharacter(p.Parent) if (player) then if (not player.PlayerGui:FindFirstChild("SpawnGUI")) then local GUI = game:GetService("ServerStorage").SpawnGUI:Clone() GUI.Regen.Value = script.Parent.Parent.Pos GUI.Parent = player.PlayerGui else player.PlayerGui.SpawnGUI.BG.Visible = true end end end)