Hi i am very new to scripting and with the help of you guys i've created this local script with a gui
-- creating a screen gui
local screenGui = Instance.new("ScreenGui")
screenGui.Parent = script.Parent
--make a text button
local textButton = Instance.new ("TextButton")
textButton.Parent = screenGui
textButton.Position = UDim2.new(0,50,0,150)
textButton.Size = UDim2.new(0,140,0,60)
textButton.TextColor3 = BrickColor.White().Color
textButton.Style = 2
textButton.Text = "Swordsman"
--Bind function to button click
textButton.MouseButton1Down:connect(function()
p = game.Players.LocalPlayer
sword = game.ReplicatedStorage.ChristmasTreeSword:clone()--Weapon name
shield = game.ReplicatedStorage.Shield:clone()
if p.Backpack:FindFirstChild(sword.Name)~= nil then return end
if p.Backpack:FindFirstChild(shield.Name)~= nil then return end
p.Backpack:ClearAllChildren()
sword.Parent = p.Backpack
shield.Parent = p.Backpack
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 20
end)
Now that this script is there, i don't want people to have multiple items and abuse this script as i have 3 gui's that give different items each, and if you're holding an item it, is not destroyed. I also don't want people constantly switching classes. How would i delete multiple gui's after any one of them are clicked.
Details: guis are: Swordsmangiver, Roguegiver, Marksmangiver
Thank you for reading and taking the time to consider!

3 comments
thank you very much
pls press 'Accept Answer'
Oh my bad XD