Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is this a userdata??

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

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.