I am trying to write a gun system, in which a single client script handles all of the input and gun logic.
Everytime I try to access the backpack via a client script IT WONT SHOW THE CHILDREN!
I’ve tried everything, from waiting for the child, finding first child (+ of class), delaying the script, waiting until LocalPlayer.Backpack ~= nil EVERYTHING, but it always returns an empty table WHEN I DO HAVE TOOLS IN IT.
local PLAYERS_SERVICE = game:GetService("Players")
local localPlayer = PLAYERS_SERVICE.LocalPlayer
local localBackpack = localPlayer:WaitForChild("Backpack")
print(localBackpack:GetChildren())
local PLAYERS_SERVICE = game:GetService("Players")
local localPlayer = PLAYERS_SERVICE.LocalPlayer
local localBackpack = localPlayer:WaitForChild("Backpack")
local Tools = {}
for i,v in pairs(localBackpack:GetChildren()) do
table.insert(i,Tools)
end
print(table.unpack(Tools))
I’ve already tried that, in fact I decided to try it again, waited 40 seconds before trying to get the children and still 13:22:25.430 {} - Client - GunClient:44
local repS = game:GetService('ReplicatedStorage')
reps:WaitForChild('Loaded').OnClientEvent:Connect(function())
local backpack = game.Players.LocalPlayer.Backpack
end