This is my script.
local Gui = script.Parent.ShopGui:clone()
function onTouched(hit)
local human = hit.Parent:findFirstChild("Humanoid")
local life = human.Parent.Name
if (human ~= nil ) then
local Gui = script.Parent.ShopGui:clone()
Gui.Parent = game.Players.LocalPlayer.PlayerGui
end
end
script.Parent.Touched:connect(onTouched)
In test mode, it works fine. But in online mode, the gui doesn't appear.

3 comments
Is it in a local script?
No, it is not in a local script.
You can't get LocalPlayer from players in a local script outside of studio