When I looked up this question like this, I got something like game.Players.Localplayer.PlayerGui
and it makes me ask some other questions like "How do I access the PlayerGui?", "How do I add the guis inside the PlayerGui?". I want a simple explanation so I can make my dialog script work. If someone can help me, please explain it to me in a simple way.
A simple way to do this, is: Using remotevents
To make something like this, insert a part, into workspace a remotevent replicatedstorage name the remoteevent "OpenGui", now create a server script inside the part and a local script inside the screengui
Server script
script.Parent.Touched:Connect(function(hit) local plr = game.Players:GetPlayerFromCharacter(hit.Parent) game.ReplicatedStorage.OpenGui:FireClient(plr) end)
Local script
game.ReplicatedStorage.OpenGui.OnClientEvent:Connect(function() script.Parent.Frame.Visible = true -- Change frame to what ever the frame name is end)
Maybe this:
script.Parent.Touched:connect(function(hit) local plr = game.Players:GetPlayerFromCharacter(hit.Parent) end)
still working on it
PlayerGui is basically StarterGui but when a player joins all of the contents of StarterGui go into PlayerGui.
You can get playergui by doing something like local playergui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
WaitForChild waits for the gui to be inside the player before it gets it.
Just add your guis in startergui and every gui will pop up there! If you have anymore questions feel free to dm on discord fefe#0449 or comment
-- EDIT
Just realised your question sorry
local part = --Put your part directory here part.Touched:Connect(function(hit) local character = hit.Parent.Parent local player = game.Players.LocalPlayer -- Your gui stuff here gui.Visible = true end)