Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Loading items in local script from folder in Players?

for i,v in pairs(game.Players.LocalPlayer:WaitForChild("Inventory"):GetChildren()) do
		
	if game.Players.LocalPlayer.Inventory:FindFirstChild(v) ~= nil then
		
	game.Players.LocalPlayer.Inventory[v]:Clone().Parent = script.Parent
	
	end
end

I get no errors at all but it doesn't load the players items into the GUI.

1 answer

✓ Accepted answer

Use local script and you can create a variable for player, not use game.Players.LocalPlayer.Inventory[v]:Clone().Parent = script.Parent the correct is v:Clone().Parent = script.Parent Try it:

repeat wait() until game.Players.LocalPlayer
local plr = game:GetService("Players").LocalPlayer
local inv = plr:FindFirstChild("Inventory")

for i,v in pairs(inv:GetChildren()) do
	if v ~= nil then
		v:Clone().Parent = script.Parent
	end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.