Skiddx10
|
  |
| Joined: 05 Jul 2013 |
| Total Posts: 8 |
|
|
| 29 Dec 2015 08:55 AM |
Trying to make a fighting game but i cant clone the map and it says this:
attempt to call method 'Clone' (a nil value)
Help!
|
|
|
| Report Abuse |
|
|
|
| 29 Dec 2015 08:57 AM |
| Post your code or we can't help you. |
|
|
| Report Abuse |
|
|
Skiddx10
|
  |
| Joined: 05 Jul 2013 |
| Total Posts: 8 |
|
| |
|
Skiddx10
|
  |
| Joined: 05 Jul 2013 |
| Total Posts: 8 |
|
|
| 31 Dec 2015 12:46 AM |
local mapsinserverstorage = game:GetService("ServerStorage") local chosenmap = mapsinserverstorage[math.random(1, #mapsinserverstorage) chosenmap:Clone().Parent = game.Workspace.mapholder |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2015 12:48 AM |
mapsinserverstorage[math.random(1, #mapsinserverstorage)]*
|
|
|
| Report Abuse |
|
|
mudkip99
|
  |
| Joined: 17 Jun 2008 |
| Total Posts: 3362 |
|
|
| 31 Dec 2015 12:50 AM |
mapinserverstorage isn't an array, it's the service itself. You'll need to call GetChildren() on it to get an array of it's children, like this:
local serverStorage= game:GetService("ServerStorage") local maps = serverStorage:GetChildren() local chosenmap = maps[math.random(1, #maps) chosenmap:Clone().Parent = game.Workspace.mapholder |
|
|
| Report Abuse |
|
|
mudkip99
|
  |
| Joined: 17 Jun 2008 |
| Total Posts: 3362 |
|
|
| 31 Dec 2015 12:58 AM |
| Also, like Advanced said, close the square brackets around the array index. |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2015 01:19 AM |
also you may use server storage for other objects than maps, consider putting the maps in side a model in server storage
http://www.roblox.com/ITS-FREE-item?id=130771265&rbxp=8320118 |
|
|
| Report Abuse |
|
|
Skiddx10
|
  |
| Joined: 05 Jul 2013 |
| Total Posts: 8 |
|
| |
|