There are many ways you could do this.
First of all, you could already have the GUI inside the StarterGui and make it visible when you touch.
Or you could clone the GUI from ServerStorage. Let's do this.
First, insert your GUI inside ServerStorage.
Then, let's change define a few variables
local serverstorage = game:GetService("ServerStorage")
local gui = serverstorage:WaitForChild("ScreenGui")
script.Parent.Touched:connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local playergui = player:WaitForChild("PlayerGui")
local guiclone = gui:Clone()
guiclone.Parent = playergui
end)
I hope this helped!
1 comment
how can i access the gui from another script if its moving around