Can't change value of StringValue?
Asked by
6 years ago Edited 6 years ago
I am trying to choose maps from the ReplicatedStorage and set the value of a StringValue to the name of the map:
01 | local players = game.Players:GetChildren() |
02 | local maps = game.ReplicatedStorage.Maps:GetChildren() |
03 | local currentmap = game.Workspace:WaitForChild( "CurrentMap" ) |
04 | local chosen = script.ChosenMap |
05 | local spawner = game.Workspace.Spawn |
10 | if maps [ i ] :IsA( "Model" ) then |
11 | maps [ i ] = #choices + 1 |
14 | local picked = math.random( 1 , #choices) |
15 | print (choices [ picked ] ) |
16 | chosen.Value = choices [ picked ] .Name |
Some of this code was changed a bit from someone in my last post.
But it just prints table: 33931ACC
and an error pops up every time and I can't figure out why:
Workspace.CurrentMap.Script:25: bad argument #3 to 'Value' (string expected, got nil)