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

How do I access a gui in playergui?

Asked by 4 years ago

I'm trying to make this screen gui show when they click a block. This is what I've tried:

GUI = game.ReplicatedStorage.HighGunStore1Frame
game.Players.LocalPlayer:GetChildren()
Event = game.ReplicatedStorage.Events.IllegalGunStore



script.Parent.MouseClick:Connect(function(player)

    Event:FireClient()      
            game.Players.LocalPlayer.PlayerGui.LocalScript.Disabled = false



    end
end)

The local script that it is changing to not disabled has this code:

script.HighGunStoreFrame.Visible = true

1 answer

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

Instead try this.

Make a Part in workspace with a click detector inside it

Put a script in the click detector

Put the gui you want into the part and put this code into the script

Change GuiNameHere to the guis name

local Debounce = false
script.Parent.MouseClick:Connect(function(PlayerWhoClicked)
if Debounce = false then
Debounce = true
local NewGui script.Parent.Parent.GuiNameHere:Clone()
NewGui.Parent = PlayerWhoClicked.PlayerGui
else
for i, v in pairs(PlayerWhoClicked.PlayerGui:GetChildren()) do
if v.Name == "GuiNameHere" then
v:Destroy()
end
end
end
end)

Please accept this answer if this helped!

0
So does it matter if its a frame or a gui because its a frame not a gui I didn't post the question correctly, sorry if this caused any trouble. It didn't work. TheP_irate 4 — 4y
0
You must have a ScreenGui then a Frame inside the ScreenGui. If there is no ScreenGui the frame will not how no matter what. Also please accept this answer, it helps me out a lot. ScriptedEli 101 — 4y
Ad

Answer this question