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 access a gui in playergui?

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

✓ Accepted answer

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!

2 comments

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.

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.

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