Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[SOLVED] Why will the player's backpack not clear?

Asked by 3 years ago
Edited 3 years ago

I'm running a remote event through replicated storage at the client to clear their backpack.

Local script:

local Backpack = game:GetService("Players").LocalPlayer:WaitForChild("Backpack")
local ClearBackpackEvent = game:GetService("ReplicatedStorage"):WaitForChild("ClearBackpack")
ClearBackpackEvent.OnClientEvent:Connect(function()

    print("Recieve")
    Backpack:ClearAllChildren()

end)

Server-side script:

wait(10) --Waiting for the game to load
local Event= game:GetService("ReplicatedStorage"):WaitForChild("ClearBackpack")
Event:FireClient(game:GetService("Players").wwwaylon09)

I received the local script's printed message in my output bar, yet the players backpack doesn't get cleared.

Does anyone know why?

Solution:

For whatever reason, the players backpack does not register with any children when called from the player, I put the local script in the character model and it worked fine. Possible engine bug?

0
i think its :ClearChildren() jedistuff2 89 — 3y
0
not :ClearAllChildren jedistuff2 89 — 3y
0
Nope, if it was a mistype it would error, I can confirm it is :ClearAllChildren() wwwaylon09 113 — 3y

Answer this question