I am trying to make it so that when I equip "The wizard staff " a gui will appear on the users screen and when they unequipped it the gui shall disappear. I am firing the server with an event. The problem arrives after gui appears and disappears. When the event triggers a third time I get the error: The Parent property of WizardStaffGui is locked, current parent: NULL, new parent PlayerGui
Here is the relevant code
local WizardStaffGui = game.ServerStorage.Guis.WizardStaffGui:Clone()
game.ReplicatedStorage.WizardStaffGui.OnServerEvent:Connect(function(player)
if player.PlayerGui:FindFirstChild("WizardStaffGui") == nil then
WizardStaffGui.Parent = player.PlayerGui
else
player.PlayerGui:FindFirstChild("WizardStaffGui"):Destroy()
end
end)
