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

How do I find and list hats the player is currently wearing?

Asked by 3 years ago

Hi all, I'm incredibly new at scripting, and I'm stuck on trying to find and list a player's current hats in a scrolling frame. The few attempts that I have made have ended in failure, so if there's anything I'm missing, please reach out.

0
You should be using scriptinghelpers for help on scripts that arent working. Otherwise if you are incredibly new, its better you try to learn to script before making anything. PrestonsWeekends 20 — 3y

1 answer

Log in to vote
0
Answered by
5xbh 17
3 years ago

Hey, I'm currently on a mobile device, so if I have any syntax errors, you know why. Anyways, to get a list of hats the player is wearing, you would use for i,v in pairs loops like this.

for i, v in pairs(game:GetService("Players").LocalPlayer.Character:GetChildren())
if v:IsA("Accessory") or v:IsA("Hat") then
print(v)
end
end

I'm not completely sure how to make new textlabels with perfect positions with that, but I do know you would use instance.new to constantly create new textlabels after it finds each accessory.

Ad

Answer this question