Here is my script to clone the ui. It is SUPPOSED to check whether or not the UI is in PlayerGui and will clone it if it is not.
script.Parent.UpperTorso.ClickDetector.MouseClick:Connect(function(plr)
if not plr.PlayerGui:FindFirstChild("NPC") then
local clone = script.Parent.NPC:Clone() ----{0.175, 0},{0.185, 0}
clone.Parent = plr.PlayerGui
clone.MainFrame:TweenSize(UDim2.new(0.649,0,0.63,0, "Out", "Quad", 0.5))
wait(1)
clone.MainFrame.Body.Visible = true
clone.MainFrame.MainFrame2.Visible = true
end
end)
GUI Script:
--// Variables
local NPCUI = script.Parent
local MainFrame = NPCUI.MainFrame
local Body = MainFrame.Body
local MainFrame2 = MainFrame.MainFrame2
--// Functions
MainFrame2.Exit.MouseButton1Click:Connect(function()
MainFrame.Body:Destroy()
MainFrame.MainFrame2:Destroy()
MainFrame:TweenSize(UDim2.new(0.016,0,0.63,"Out","Quad",0.5))--{0.649, 0},{0.63, 0}
wait(1)
NPCUI:Destroy()
end)
--// Made by Aquawoman
I need some help, please. If this is not enough info, you can comment down in the question. Thank you very much.

10 comments
What happens when you test this script, and how does it differ from what you want to happen?
The first time I click on the NPC it works, however, when I click it the second time, the GUI doesn't appear.
this is because you are not removing the gui from the player gui
If you want the NPC's UI to appear again only after you've closed it first, you should use :Destroy() on plr.PlayerGui.NPC when the UI is closed. In that case the culprit might not be the script you've posted.
I see. I have just edited the question aka the script from above to help you out.
Thanks! Could you also tell us if the ClickDetector script is a LocalScript or a regular Script, and the same about the GUI script?
no this is actually not needed since it is a clickdetector, the clickdetector gets a signal when its clicked on which player clicked it and can then access their playergui and other things
My script for the click detector to work is just on a regular script, not a local script. For the GUI, it is a local script.
good thats how it should be but i just realised why it wont show up and i will put it down as an answer
Nevermind.