|
| 09 Jun 2014 04:25 AM |
Hey There! Im kinda new to Scripting, so this is probably a dumb question, but why doesnt this work???? It doesnt give any error, it just doesnt do anything. Its supposed to remove the Hat of the Random Player.
function randomPlayer() local players = game.Players:GetPlayers() return players[math.random(#players)] end local vanishing = randomPlayer()
if vanishing.Character:GetChildren().ClassName=="Hat" then remove() end
THX! Planesoldier |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2014 04:31 AM |
Tried this:
if vanishing.Character:GetChildren()[i].ClassName=="Hat" then vanishing.Character[i]:Remove()
Still wont work... |
|
|
| Report Abuse |
|
|
magoo8
|
  |
| Joined: 25 Apr 2009 |
| Total Posts: 1122 |
|
|
| 09 Jun 2014 04:33 AM |
| Use a free model, study the script and see if you can make your own. |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2014 04:38 AM |
| I tried, but it wont work.... |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2014 04:46 AM |
Used this now:
for i=1, #vanishing.Character:GetChildren() do if (vanishing.Character:GetChildren()[i].className == "Hat") then vanishing.Character:GetChildren()[i]:remove() end end
But it removes 1 hat and then gives this error:
11:45:33.048 - ServerScriptService.Main Script:124: attempt to index field '?' (a nil value) |
|
|
| Report Abuse |
|
|
| |
|