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

How would I make a Gui appear without the person having to reset?

Asked by
tumadrina 179
9 years ago

I did

local Blue=workspace.Blue
Blue.ClickDetector.MouseClick:connect(function()
    local Btb=Instance.new("TextButton")
    Btb.Parent=game.StarterGui.ScreenGui
    Btb.Size=UDim2.new(0,70,0,70)
end)

I know I went wrong by putting it under StarterGui since I figured out that it works once you die. Is there a service that makes the Gui appear when you insert it?

1 answer

Log in to vote
1
Answered by 9 years ago

What you need to do is edit the GUI inside their PlayerGui.

Luckily, .MouseClick returns a Player instance. So you just need to modify your code like so:

local Blue=workspace.Blue
Blue.ClickDetector.MouseClick:connect(function(player) --ClickDetector.MouseClick returns a Player Instance
    local Btb=Instance.new("TextButton")
    Btb.Parent=player.PlayerGui.ScreenGui -- parent the TextButton to their PlayerGui
    Btb.Size=UDim2.new(0,70,0,70)
end)

Note: This code won't work if you have FilteringEnabled turned on (because the PlayerGui doesn't replicate to the server)

0
THank you, that would have never crossed my mind... tumadrina 179 — 9y
Ad

Answer this question