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

How do I make a screenGui pop up on click?

Asked by 9 years ago

I know it has something to do with cloning to to the StarterGui, but I don't know how. Any help would be appreciated. Here is the start of the script.

1function show()
2 
3    end
4 
5script.Parent.ClickDetector.MouseClick:connect(show)

3 answers

Log in to vote
0
Answered by 9 years ago
1function show()
2plr:WaitForChild("PlayerGui").ScreenGui.Frame.Visible = true
3end
4 
5script.Parent.ClickDetector.MouseClick:connect(function(plr)
6show()
7end)
Ad
Log in to vote
0
Answered by 9 years ago

You where correct with the function, So to continue on that we need to clone the gui into the players Playergui

01function FindClosestPlayer()
02dist = 20
03pl = ""
04    for i,v in pairs(game.Players:GetPlayers()) do
05        if v.Character ~= nil then
06            if (v.Character.Torso.Position - script.Parent.Position).magnitude < dist then
07                dist = (v.Character.Torso.Position - script.Parent.Position).magnitude
08                pl = v.Name
09            end
10        end
11    end
12    if pl ~= "" then
13        return pl
14    end
15end
View all 32 lines...

Gui must be in the script, and script in the part.

Hope this helps

0
error: Script:3 attempt to index global 'hit' (a nil value) Here is what my script looks like function show() guin = control --Gui name if game.Players:findFirstChild(hit.Parent.Name) ~= nil then player = game.Players[hit.Parent.Name] if player.PlayerGui:findFirstChild(guin) == nil then gui = script.Control:clone() gui.Parent = player.PlayerGui My_Comment 95 — 9y
0
Ok, i fixed it, its a bit longer but, its more effective then my original code ghosteffectz 115 — 9y
0
I do like that the character is stuck into position when clicked, but i need it to let them move when the Gui is out of their playerGui. My_Comment 95 — 9y
0
And, maybe i can also put a walkspeed=16 script inside my close script. the close script is 3 Parents away from the ScreenGui, if that helps you. My_Comment 95 — 9y
0
Hello?? My_Comment 95 — 9y
Log in to vote
0
Answered by 9 years ago

Just do this:

function Clicked() game.StarterGui.ScreenGui.Frame.Visible = true end script.Parent.MouseButton1Down:connect(Clicked)

-- This is just a basic way of trying to make a Gui show up. If you want to get advanced you would use a loop.

Answer this question