I was wondering how to make a gui dissapear after it's clicked and when the character respawns it would reapear. Here is my script just to see if you coulda find something wrong. I tried game.StarterGui.Swordsmangiver.Disabled but it did not not work. if you could help me that would be greatly appreciated.
-- 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 = 3 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 p.Character.Humanoid.WalkSpeed = 18 end)
Things to consider: This is a localscript inside the StarterGui. The script works and everything but i don't know how to disable after click and renable after death.
Assuming you want it do disable after clicking the textButton:
-- 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 = 3 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 p.Character.Humanoid.WalkSpeed = 18 screenGui:Destroy() end)
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.