say I joined a game and wanted to delete my hat how would I delete my hat without knowing the name of it but just by knowing the classname??
Well, you would use the for
loop for that, let me show you;
for i,v in pairs(game.Workspace.Player1:GetChildren()) --The for loop gets all the children within Player1, will loop through all children that are currently in Player1 if v:IsA("Hat") then --This checks if the children are classified as a Hat (if some are parts, will return those ones nil, and get the classified Hat) v:Destroy() --This will Destroy the Hat(s) end --The is the end for the 'if' statement end --This is the end to end the for loop
Hope this helped!