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

Why is this a userdata??

Asked by 8 years ago

Im not sure why.. Im stumped.


local ServerStorageMaps = game.Lighting:WaitForChild("ServerMaps") local ServerMaps = ServerStorageMaps print(ServerMaps) -- How the heck is this a userdata?!?!?! NewServerMap = ServerMaps[math.random(1,#ServerMaps)]:Clone() NewServerMap.Parent = MapModel

Error :

15:52:17.933 - Workspace.Main-Script:232: attempt to get length of local 'ServerMaps' (a userdata value)
15:52:17.934 - Stack Begin
15:52:17.935 - Script 'Workspace.Main-Script', Line 232
15:52:17.936 - Stack End

Um.. I have no idea.

1 answer

Log in to vote
1
Answered by
Unclear 1776 Moderation Voter
8 years ago

It looks like you're trying to get a random child. ServerMaps is currently pointing to an object, it isn't pointing to a table with the children.

local ServerMaps = ServerStorageMaps:GetChildren()

should fix it.

Ad

Answer this question