Attempt to index local error, fix? [ SOLVED ]
Asked by
8 years ago Edited 8 years ago
I am making a game and I keep getting this error:
11:31:09.326 - Workspace.GameScript:10: attempt to index local 'map' (a number value)
11:31:09.330 - Stack Begin
11:31:09.332 - Script 'Workspace.GameScript', Line 10 - global chosemap
11:31:09.369 - Script 'Workspace.GameScript', Line 21
11:31:09.371 - Stack End
Here is the script:
01 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
02 | local ServerStorage = game:GetService( "ServerStorage" ) |
03 | Status = ReplicatedStorage.Status |
05 | local chosenmap = script.MapChosen.Value |
06 | local maps = ServerStorage.Maps:GetChildren() |
09 | local map = math.random( 1 ,#maps) |
10 | local cmap = map:Clone() |
11 | cmap.Parent = workspace |
22 | Status.Value = "Selecting Map...." |
24 | Status.Value = "Selected Map: " .. chosenmap |
I've been making scripts like this for a while and I have no IDEA why this is happening, I fixed it before but I forgot ;-;