Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

?HELP? How i destroy a Gui from PlayerGui Folder when i will touch a part?

Here is the script that put a Gui into PlayerGui Folder when i click a block:

function boop(Player) if not Player.PlayerGui:FindFirstChild("Gui") then local gui = script.Gui:clone() gui.Parent = Player.PlayerGui gui.LocalScript.Disabled = false end end script.Parent.ClickDetector.MouseClick:connect(boop)

The Gui that appears in PlayerGui Folder is named: Gui I need to make it destroy (the ”Gui” from PlayerGui Folder) when i touch a part named: Test2000

I hope u can help me guys!

1 comment

0

so instead of clicking, you want it to be removed when touched?

2 answers

local touchPart = -- The part you want to activate the gui:Destroy
local gui = -- The GUI

touchPart.Touched:Connect(function()
	gui:Destroy

Haven't tested, but it should work. If destroy doesn't work, here:

local touchPart = -- The part you want to activate the gui:Destroy
local gui = -- The GUI

touchPart.Touched:Connect(function()
	gui.Enabled = false

--IF ITS A FRAME THEN USE THIS--

touchPart.Touched:Connect(function()
	gui.Visible = false

--Put the script inside the Part local gui="Gui" -- the name of the gui local Players=game:GetService"Players" script.Parent.Touched:Connect(function(v) local char=v.Parent local player=char and Players:GetPlayerFromCharacter(char) local gui=player and player.PlayerGui:FindFirstChild[gui] gui=gui and gui:Destroy() end)

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