Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do i only make GUI's appear on one person's screen?

Asked by 3 years ago

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

0
It shouldn't do that since this is a local script... Nguyenlegiahung 1091 — 3y
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. Cynical_Innovation 595 — 3y
0
You need to check who touched the gui so only that player's gui is activated Leamir 3138 — 3y
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. TheMiniWintress 7 — 3y
View all comments (2 more)
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... ^^^ TheMiniWintress 7 — 3y
0
Oh, okay. Cynical_Innovation 595 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your 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

0
Why is the Gui variable a string? How come you didn't just straight up define the Gui. Cynical_Innovation 595 — 3y
0
Alright.. Cause i like it that way lol. Nguyenlegiahung 1091 — 3y
0
Hmm. Does that make it any better? Or is it just personal preference? Cynical_Innovation 595 — 3y
0
personal preference probably Nguyenlegiahung 1091 — 3y
0
Ah, that script above worked - thanks! TheMiniWintress 7 — 3y
Ad

Answer this question