PVP Zone Script Problem – GUI Not Removing


The player in the first SS is outside the PVP zone.
The player in the second SS walks into the PVP zone with the sign tool equipped and has walked out.

When a player enters the PVP zone, the zone removes all of their tools and gives them a sword.

The Problem

The tools are correctly taken away inside the zone; however, the GUI attached to the tool stays on the screen even after the player leaves the zone and gets their tools back.
If the player enters the zone with the tool multiple times, the GUI duplicates and keeps stacking, which causes a problem.

All the work (giving and removing tools) is done in one script.
How can I fix the GUI issue?

you can delete the gui that is inside playergui using the same event that removes the tools

1 Like

In each tool, you could do something like this:

tool.Destroying:Connect(function()
    toolGui:Destroy()
end)

The tool variable will just be the main tool (if you don’t have that variable, you can simply replace it with script.Parent). The toolGui variable is a reference to the GUI that corresponds to the tool. This will ensure that each tool takes care of its own GUI.