My GUI won't appear when a player dies. Please help?
Asked by
4 years ago Edited 4 years ago
I have a GUI gun giver for a gun game and the script keeps interfering with the GUI so it does not appear when a player dies. (Yes, ResetonSpawn is enabled.)
Here is my code:
01 | player = script.Parent.Parent.Parent |
02 | backpack = player.Backpack |
04 | function chooseClass(class) |
05 | for i, v in pairs (backpack:GetChildren()) do v:remove() end |
06 | for i, v in pairs (class:GetChildren()) do |
08 | v:clone().Parent = backpack |
09 | elseif v:IsA( "HopperBin" ) then |
10 | v:clone().Parent = backpack |
14 | script.Parent.Main.Visible = false |
15 | script.Parent.Title.Visible = false |
18 | function onHumanoidDied(humanoid, player) |
19 | script.Parent.Main.Visible = true |
20 | script.Parent.Title.Visible = true |
23 | for i, v in pairs (script.Parent.Main:GetChildren()) do |
24 | v.MouseButton 1 Up:connect( function () chooseClass(v) end ) |