Here's the code:

owner = ""

script.Parent.Touched:connect(function(part)
    if part.Parent and game.Players:playerFromCharacter(part.Parent) then
       	local player = game.Players:playerFromCharacter(part.Parent)
		print(player)
		game.Players:FindFirstChild(player.Name).PlayerGui.Turf.Frame.Visible = true
		script.Parent:Destroy()
		owner = player.Name
		print(owner)
    end
end)

function Leaving(owner)
	script.Parent:Clone()
	print(1)
end

player1 = game.Players:FindFirstChild(owner)
player1.PlayerRemoving:connect(Leaving)
print(owner)

The part isn't re-appearing after the owner leaves.

1 comment

0

You have to set a parent to a parent after you clone it. Also if FilterEnabled is turned on this wouldn't work.