So basically I was doing a shop that would pop up when the player would click a dummy in workspace. So I used a ClickDetector and made a ShopGui which I inserted in the dummy.
The Script in the dummy looks like this:
local clickDetector = script.Parent.ClickDetector local gui = script.Parent.ShopGui clickDetector.MouseClick:Connect(function(player) if not player.PlayerGui:FindFirstChild("ShopGui") then print("Cloning...") local clone = gui:Clone() clone.LocalScript.Disabled = false clone.Parent = player.PlayerGui else print("lolwut") end end)
The LocalScript in the GUI looks like this:
local gui = script.Parent.Frame local buy = gui.Buy local sell = gui.Sell local exit = gui.Exit exit.MouseButton1Click:Connect(function() script.Parent:Destroy() end)
After the first time clicking the dummy the ShopGui appears in the player's PlayerGui and prints "Cloning...". Then it always prints "lolwut" no matter if the ShopGui is there or not. I'm stuck.
I believe you are cloneing in the GUI from a server script and destroying it from a localscript. This will cause the issue where the server will think the player still has the GUI because it was the CLIENT that removed it.