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 only make GUI's appear on one person's screen?

So, I was having difficulty with my guis and then found out I had to edit them via the playergui and not startergui. However, when I'm doing this, it is making changes to everybody's PlayerGui.

I have simplified thelocal script, placed in PlayerScripts, so it is easier to read.

local tr = game.Workspace.EP1.tr           --This is just a brick.
local playergui = game.Players.LocalPlayer:WaitForChild("PlayerGui")

tr.Touched:Connect(function(hit)   ---brick is touched
	playergui.EP1.R.Enabled = true 
	tr.BrickColor = BrickColor.new("Pink")
end)

How can I assure that the ScreenGui object is only appearing on the screen of whoever touched the brick?

Thanks in advance

6 comments

0

It shouldn't do that since this is a local script...

0

Instead of putting the script into PlayerScripts, you could just place the script inside the Gui itself. In my opinion, it makes it a lot easier for me to find everything.

0

You need to check who touched the gui so only that player's gui is activated

0

I tried figuring out who presses the gui, touched only works for bricks though. Unless there's another way to see who has pressed a textbutton.

0

Oh btw, I also tried putting it as a child of the textbutton but same issue. no idea why since it is a local script... ^^^

0

Oh, okay.

1 answer

✓ Accepted answer

Welp if the local script doesn't work probably for u then i have another way :D This is activate the gui through the server, put this script inside a part you want to be touched

(Normal Script)


script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then -- Check if it a character if yes, then:
	local player =game.Players:GetPlayerFromCharacter(hit.Parent) -- Get the player
	
	local GUI =player.PlayerGui:FindFirstChild("GUI") -- Your Gui 

	GUI.Enabled = true -- Enable the GUI
	end
end)

Hope that helped

5 comments

0

Why is the Gui variable a string? How come you didn't just straight up define the Gui.

0

Alright.. Cause i like it that way lol.

0

Hmm. Does that make it any better? Or is it just personal preference?

0

personal preference probably

0

Ah, that script above worked - thanks!

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