Geargeez
|
  |
| Joined: 28 Nov 2014 |
| Total Posts: 842 |
|
|
| 22 Apr 2017 08:23 PM |
idk how to make one like i need it to remove all accessories/hats on head
|
|
|
| Report Abuse |
|
|
|
| 22 Apr 2017 08:33 PM |
iterate through the children of the player character:
for _,item in pairs(player.Character:GetChildren()) do if item:IsA("Accoutrement") then item:Destroy() end end |
|
|
| Report Abuse |
|
|
|
| 22 Apr 2017 08:35 PM |
Humanoid:RemoveAccessories()
|
|
|
| Report Abuse |
|
|
Briicks
|
  |
| Joined: 03 Apr 2015 |
| Total Posts: 1796 |
|
|
| 22 Apr 2017 08:48 PM |
WHAT!? When did that become a thing, "RemoveAccessories()"?
|
|
|
| Report Abuse |
|
|
|
| 22 Apr 2017 09:11 PM |
| ^ a while ago.. lol. It replaced Hats:Remove() |
|
|
| Report Abuse |
|
|
|
| 22 Apr 2017 09:12 PM |
"It replaced Hats:Remove()"
...
|
|
|
| Report Abuse |
|
|
|
| 22 Apr 2017 09:14 PM |
if v:IsA'Hat' then v:Remove()
yah, i explained it bad |
|
|
| Report Abuse |
|
|
|
| 22 Apr 2017 09:15 PM |
You're implying that Remove wasn't deprecated before RemoveAccessories was added...
|
|
|
| Report Abuse |
|
|
|
| 22 Apr 2017 09:19 PM |
God damn unsub, you dont let anything go, do you.
v:IsA'Hat' then v:Destroy()
hapi e.e |
|
|
| Report Abuse |
|
|
SunShiba
|
  |
| Joined: 09 Mar 2014 |
| Total Posts: 30030 |
|
|
| 22 Apr 2017 10:03 PM |
Ya I was having trouble with that too
What I did was this:
Script 1:
function onTouched(hit) local d = hit.Parent:GetChildren() for i=1, #d do if (d[i].className == "Accessory") then d[i]:remove() end end end
script.Parent.Touched:connect(onTouched)
Then I added a script 2 that is the same as Script 1 but instead of "Accessory" I did "Hat" for my game because there are things in my game that still classify as Hats
|
|
|
| Report Abuse |
|
|
|
| 22 Apr 2017 10:04 PM |
SunShiba, how about actually reading the thread before posting? That's unnecessary and you're using a deprecated property and function.
The RemoveAccessories function exists.
|
|
|
| Report Abuse |
|
|
SunShiba
|
  |
| Joined: 09 Mar 2014 |
| Total Posts: 30030 |
|
|
| 22 Apr 2017 10:05 PM |
| Im trying to help and youre being rude |
|
|
| Report Abuse |
|
|
|
| 22 Apr 2017 10:06 PM |
Posting an overcomplicated solution and using deprecation is just misleading.
|
|
|
| Report Abuse |
|
|
SunShiba
|
  |
| Joined: 09 Mar 2014 |
| Total Posts: 30030 |
|
|
| 22 Apr 2017 10:08 PM |
| As long as it works then whats the problem... |
|
|
| Report Abuse |
|
|
|
| 22 Apr 2017 10:08 PM |
"As long as it works"
That's a terrible philosophy to go by when programming.
|
|
|
| Report Abuse |
|
|
SunShiba
|
  |
| Joined: 09 Mar 2014 |
| Total Posts: 30030 |
|
|
| 22 Apr 2017 10:16 PM |
| Well I just started getting into this 'scripting' thing about 2 weeks ago. Im just trying to offer help to someone |
|
|
| Report Abuse |
|
|
Briicks
|
  |
| Joined: 03 Apr 2015 |
| Total Posts: 1796 |
|
|
| 22 Apr 2017 11:26 PM |
| Don't use ################### I tried it multi times and it didn't always remove everything, I was left with 1 hat on still almost everytime. |
|
|
| Report Abuse |
|
|
Briicks
|
  |
| Joined: 03 Apr 2015 |
| Total Posts: 1796 |
|
| |
|
|
| 22 Apr 2017 11:28 PM |
That's because the item wasn't converted to an accessory by ROBLOX yet. If it still happens then go ahead and loop, but there shouldn't be any items that are left over. If there are, I'd tell ROBLOX.
|
|
|
| Report Abuse |
|
|
Briicks
|
  |
| Joined: 03 Apr 2015 |
| Total Posts: 1796 |
|
|
| 22 Apr 2017 11:29 PM |
Yes it is, I thought that myself and I checked the item.
|
|
|
| Report Abuse |
|
|