How do you remove everything in a player's backpack?
So this is my script this is a rebirth
now if you see in the code theres a child:remove()
When i tested it it doesnt remove the child like how plz help im a nub at scripting :)
01 | local replicatedStorage = game:GetService( "ReplicatedStorage" ) |
02 | local StarterRebirthAmount = 60000 |
03 | local player = game.Players.LocalPlayer |
04 | local mainframe = script.Parent:WaitForChild( "MainFrame" ) |
05 | local rebirthMenu = mainframe:WaitForChild( "Frame" ) |
06 | local mainbutton = script.Parent.MainButton |
07 | local rebirthbutton = rebirthMenu:WaitForChild( "Rebirth" ) |
08 | local stregthnToRebirth = rebirthMenu:WaitForChild( "Strenght" ) |
09 | local rebirths = player:WaitForChild( "leaderstats" ).Rebirth |
12 | stregthnToRebirth.Text = "You need atleast " ..math.floor((StarterRebirthAmount + (rebirths.Value) * math.sqrt( 50000000 ))).. " balloons to rebirth" |
14 | mainbutton.MouseButton 1 Click:Connect( function () |
15 | mainframe.Visible = not mainframe.Visible |
18 | rebirthbutton.MouseButton 1 Click:connect( function () |
19 | local result = replicatedStorage.Remotes.Rebirth:InvokeServer() |
21 | if result = = true then |
23 | if result = = true then |
25 | local children = player.Backpack:GetChildren() |
27 | for i = 1 , #children do |
28 | local child = children [ i ] |
33 | rebirthbutton.Text = "succesfully rebirthed" |
35 | rebirthbutton.Text = "Click here to rebirth" |
38 | elseif result = = "NotEnoughBalloons" then |
39 | rebirthbutton.Text = "Pro Tip:Grind More" |
41 | rebirthbutton.Text = "Click here to rebirth" |
46 | rebirths:GetPropertyChangedSignal( "Value" ):Connect( function () |
47 | stregthnToRebirth.Text = "You need atleast " ..math.floor((StarterRebirthAmount + (rebirths.Value) * math.sqrt( 50000000 ))).. " balloons to rebirth" |
All of you have a great night or day,God bless u