So I have a script inside a block and when you touch it pops up a gui, there is a Gui in the block and its cloned and put it into your PlayerGui but when you close it, it deletes the screengui in your PlayerGui and the one in the brick is still there. But when I touch it again it does not work. it does not pop anything up. Help?



script.Parent.Touched:Connect(function(hit)
	
	
	local player = game.Players[hit.Parent.Name].PlayerGui
	
	if not player:FindFirstChild("Box") then
	
	
	
	local d = script.Parent.Box:Clone()
	d.Parent = player
	
	end
	
end)



3 comments

1

How is the GUI deleted? If it's deleted on the client, then it wouldn't replicate that to the server, causing the server to think that the GUI is still there when it's not there on the client.

0

This is generally the wrong way to do it. Use Remotes.

0

Thanks for the comments i'll try that with remotes.