Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a screen GUI show up on a local players screen when They touch a brick?

I wanted the screen GUI to pop up on only the players screen who touched it. the game is suppost to be a self paced story game that has talking. But the screen GUI projects to all players? What should I do?

1 answer

✓ Accepted answer
-- Server Script
-- Place into a part

local Players = game:GetService("Players") -- Our player service to use the GetPlayerFromCharacter method
local Main = script.Parent -- The part we will check if it's touched
local Gui = script.ScreenGui -- wherever the gui is located, in my case it's inside the script.

Main.Touched:Connect(function(HitTouch)
 local Player = Players:GetPlayerFromCharacter(HitTouch.Parent) -- Our player
 if Player and not Player.PlayerGui:FindFirstChild(Gui.Name) then
   local ClonedGui = Gui:Clone() -- Cloning a replica of the gui we will clone
   ClonedGui.Parent = Player.PlayerGui -- Parenting it to our player's PlayerGui
  end
end)

Setup should look like this. Image

Hope this has helped, have a great day.

2 comments

0

Um this didn't work in my case. Well I'm not good at scripting so can you explain a little more in detail

0

Place the script into a part as a 'Script' instance with the code i've provided putted inside the script and the Gui variable need's to be assigned to a screen gui. I've already explained enough in detail. The code does work, as i've tested.

This discussion is preserved as it was. New answers, comments, and votes are closed.