Assuming you want it do disable after clicking the textButton:
02 | local screenGui = Instance.new( "ScreenGui" ) |
03 | screenGui.Parent = script.Parent |
06 | local textButton = Instance.new ( "TextButton" ) |
07 | textButton.Parent = screenGui |
08 | textButton.Position = UDim 2. new( 0 , 50 , 0 , 150 ) |
09 | textButton.Size = UDim 2. new( 0 , 140 , 0 , 60 ) |
10 | textButton.TextColor 3 = BrickColor.White().Color |
12 | textButton.Text = "Swordsman" |
15 | textButton.MouseButton 1 Down:connect( function () |
16 | p = game.Players.LocalPlayer |
17 | sword = game.ReplicatedStorage.ChristmasTreeSword:clone() |
18 | shield = game.ReplicatedStorage.Shield:clone() |
19 | if p.Backpack:FindFirstChild(sword.Name)~ = nil then return end |
20 | if p.Backpack:FindFirstChild(shield.Name)~ = nil then return end |
21 | p.Backpack:ClearAllChildren() |
22 | sword.Parent = p.Backpack |
23 | shield.Parent = p.Backpack |
24 | p.Character.Humanoid.WalkSpeed = 18 |
Let me explain this. When the player spawns, the things from StarterGui clone into his PlayerGui. When I destroy the screenGui, I only destroy it from the PlayerGui, not the StarterGui (Where it gets cloned from). This means that when the player spawns again, the Gui can be used like normal.