Bug
If you try getting the Player’s Backpack as soon as the player joins (example: Players.PlayerAdded) and you try to parent anything like a tool. The tool will be parented to some sort of ghost backpack and will vanish. This only happens when a player joins.
game.Players.PlayerAdded:Connect(function(Player)
local Tool = Instance.new("Tool")
Tool.Parent = Player.Backpack --Gets parented to some sort of ghost backpack
end)
Repro File:
GhostBackpack.rbxl (29.4 KB)
Change the UseBackpackWorkaround in the script located in ServerScriptService to switch from Player.Backpack to the custom function and view the Backpack in Explorer.
Workaround
Use a wait of a second to prevent this or make a custom function to see if an Instance from StarterPack exists in the backpack.
local function GetActualBackpack(Player, BreakPeriod)
if BreakPeriod == nil then
BreakPeriod = 300
end
local BreakTime = os.clock()+BreakPeriod
while true do
local Backpack = Player:WaitForChild("Backpack", BreakPeriod)
if not Backpack then return end --Player left the game
local FixMysteriousBackpack = Backpack:FindFirstChild("FixMysteriousBackpack") --References BoolValue in StarterPack
if FixMysteriousBackpack then --If this variable exists then we know we got the correct backpack and not the buggy one!
FixMysteriousBackpack:Destroy() --No longer needed
return Backpack
end
if os.clock() >= BreakTime then
return --Out of time!
end
RunService.Heartbeat:Wait()
end
end
Workaround off (FixMysteriousBackpack is from StarterPack). Tool is nowhere.
Workaround on, Tool is in the Backpack.