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

How can I create a script that deletes your accessories and gives you new ones?

Asked by 1 year ago

I want to create a script that removes the player's accessories and replaces them with certain other accessories if they're on a certain team.

For example, I'd want to give my soldier team a helmet and some other things. I'd need the script to delete the player's head accessories, and give them the accessories I want. I also want these to be catalog items, I have them in my server storage. I also want to be able to do this for any other accessories, like back and front accessories, etc.

PS: I already have a script that will change the player's clothing based on their team, but I'm not quite sure how I can do it with accessories.

0
Can we play the game? roblox8881215 17 — 1y
0
What? LunaticFETCH 5 — 1y

2 answers

Log in to vote
0
Answered by 1 year ago

So just as Arsenal.

https://www.google.com/search?q=How+to+make+gun+rotates+every+death+roblox+studio&rlz=1C1GCEA_enBA1025BA1025&sxsrf=ALiCzsZyVlWCiWoTV5y6AS778xmuXsYD2w%3A1672872344867&ei=mAG2Y5m8NOmtrgTZxofwCQ&ved=0ahUKEwiZ6PqO_678AhXplosKHVnjAZ4Q4dUDCA8&uact=5&oq=How+to+make+gun+rotates+every+death+roblox+studio&gs_lcp=Cgxnd3Mtd2l6LXNlcnAQAzIFCAAQogQ6CggAEEcQ1gQQsAM6BQghEKABOgQIIRAVOgcIIRCgARAKSgQIQRgASgQIRhgAUOkFWLgUYNAVaAFwAXgAgAGvAYgByA-SAQQwLjE0mAEAoAEByAEDwAEB&sclient=gws-wiz-serp#fpstate=ive&vld=cid:d57e0787,vid:kS_RvQBguAM

Did that find your similarity?

0
Not the weapons. The player's accessories, like hats. LunaticFETCH 5 — 1y
Ad
Log in to vote
0
Answered by 1 year ago

Simply remove all their accessories and then copy them from ServerStorage into the Player accordingly?

-- Iterate all instances in the character
for _,v in pairs(character:GetChildren()) do
    if (v:IsA("Hat") or v:IsA("Accessory")) then -- While the Hat class is deprecated, it might still be used which is why I added it just in case.
        v:Destroy()
    end
end

Note that this script simply removes all the accessories in a player's character, regardless of type.

Answer this question