Im trying to get a gui to list all of the items that a character has. How would i search the character for what items they have? Edit: How do i get the items they have currently equipped?
2 Likes
Yeah, but how can i get the items they have on at the moment?
1 Like
here is an examples of more or less how you can do it.
Exemple 1:
local pl_s1 = game:GetService("Players")
local a1 = pl_s1.LocalPlayer
local a2 = a1.Character or a1.CharacterAdded:Wait()
for a3, a4 in next, a2:GetDescendants() do -- To catch all your descendants
-- Examples
if a4:IsA("Tool") then
elseif a4:IsA("BasePart") then
end
end
Exemple 2:
while true do
if game:GetService("Players").LocalPlayer.Character then
break
end
game:GetService("Players").LocalPlayer.CharacterAdded:Wait()
end
local pl_s1 = game:GetService("Players")
local a1 = pl_s1.LocalPlayer
local a2 = a1.Character or a1.CharacterAdded:Wait()
local a3 = a2:FindFirstChildWhichIsA(--[[the instance you want]])
if a3 ~= nil --[[ if the instance has a specific name, you can do that too >>]] and a3.Name == "" then
print("A")
end