#dictionary

10 messages · Page 1 of 1 (latest)

round shardBOT
#

studio** You are now Level 3! **studio

young eagle
#

im trying to make a random map chooser, and it isnt getting the mapName and imageID


--Variables
local RS = game:GetService("ReplicatedStorage")

local map = script.Parent:GetAttribute("Map")
local image = script.Parent:GetAttribute("ImageID")
local mapEvent = RS.Events.MapReload

local maps = {
    
    ["TestBaseplate"] = {
        mapName = "TestBaseplate",
        imageID = 16598957487
    },
    ["Crossroads"] = {
        mapName = "Crossroads",
        imageID = 0
    }
    
}

print(maps["TestBaseplate"].mapName)

--Functions
local function chosenMap()
    local keys = {}
    for k, _ in pairs(maps) do
        table.insert(keys, k)
    end

    local chosenMap = keys[math.random(#keys)]
    print(chosenMap)
    map = chosenMap.mapName --here
    image = chosenMap.imageID --and here
    script.Parent.MapName.Text = map
end

--Connections
mapEvent.Event:Connect(chosenMap)

slim elk
young eagle
young eagle
#

fixed it

slim elk
young eagle
#

i put the for loop outside of the function i think

#

dont remember too clearly

#

i also just used the maps table instead of keys

slim elk
#

👍🏽