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:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
Status = ReplicatedStorage.Status
local chosenmap = script.MapChosen.Value
local maps = ServerStorage.Maps:GetChildren()
function chosemap()
local map = math.random(1,#maps)
local cmap = map:Clone()
cmap.Parent = workspace
chosenmap = cmap.Name
end
while true do
for i = 5,0,-1 do
Status.Value = i
wait(1)
end
chosemap()
Status.Value = "Selecting Map...."
wait(2)
Status.Value = "Selected Map: " .. chosenmap
wait(60)
end
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 ;-;

1 comment
Awh