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!
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)