I want to have a part when you touch it a GUI comes up and you are able to close it. In workspace I have a Part named "Part". In "Part" I have a script named "OpensExampleGui" in the script I have a GUI named "ExampleGui". In ExampleGui I have a frame named "ShopFrame". In ShopFrame I have a TextButton named "Close", I want "Close" to have a script that could close the whole Gui when touched! I also have other stuff in "ShopFrame" that is just text that does not need a script..
In "OpensExampleGui" (Script that opens the ScreenGui) This is the script:
wait(1)
local near = false
local debounce = true
if near == true then
while wait(0.1) do
for i,v in pairs(game.Players:GetChildren()) do
if v.Character.Torso ~= nil then
if(v.Character.Torso.Position - script.Parent.Position).magnitude < (script.Parent.Size.X /1) + 10 then
if v.PlayerGui:findFirstChild("ExampleGui") ~= nil then return end
script.ExampleGui:clone().Parent = v.PlayerGui
end
end
end
end
elseif near == false then
if debounce == true then
debounce = false
script.Parent.Touched:connect(function(hit)
local human = hit.Parent:findFirstChild("Humanoid")
if (human == nil) then return end
local player = game.Players:findFirstChild(hit.Parent.Name)
if (player == nil) then return end
if player.PlayerGui:findFirstChild("ExampleGui") ~= nil then return end
script.ExampleGui:clone().Parent = player.PlayerGui
end)
debounce = true
end
end
This is the script that would close the whole Gui. Where do I put this??
function OnClicked()
script.Parent.TextButton.BackgroundTransparency = 1
script.Parent.TextButton.TextTransparency = 1
script.Parent.BackgroundTransparency = 1
script.Parent.TextTransparency = 1
end
script.Parent.MouseButton1Down:connect(OnClicked)
If yall don't understand, plz just help me make something where I could touch a part and a Gui comes up and it gives information and you are able to press a close button. I don't want a open button though! It would be great to link me to a youtube video also! Thanks so much, I would pay whoever help me out!

1 comment
Thanks!