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

Map Chooser script not working saying that selectMap() needs to be defined??

I'm trying to make a map chooser for the minigame server I'm making and it says that the selectMap() at line 24 needs to be defined. I don't know what to do?!??!?

local replicatedStorage = game:GetService("ReplicatedStorage")
local maps = replicatedStorage:WaitForChild("Maps")
 
function pickMap()
	local mapList = maps:GetChildren()
	local selectedIndex = math.random(1,#maps) -- Choose a random number between 1, and the number of maps available.
	local map = mapList[selectedIndex]:Clone() -- Create a clone of the map we selected.
	map.Parent = workspace -- Parent it to the workspace.
	map.Name = "Map" -- Rename the map so that we can use the unloadMap() function later to remove it.
	return mapList[selectedIndex].Name -- Return the name of the map we selected, in case we want to display it.
end
 
function unloadMap()
	if workspace:FindFirstChild("Map") then
		workspace.Map:Destroy()
	end
end
 
local h = Instance.new("Hint",workspace)
 
while true do
	h.Text = "Picking new map..."
	wait(3)
	local mapName = selectMap()
	h.Text = "Selected map: "..mapName
	wait(3)
	h.Text = "Unloading map..."
	unloadMap()
	wait(3)
end

1 answer

Surely it's because your function is actually called pickMap()

9 comments

0

1 sec

0

Lol

0

Didn't work selectMap is post to sat the name of the map that has been picked.

0

*say

1

@Goomig But selectMap doesn't exist. Read your own code xD

0

Dang. People always snagging the easy ones.

0

What am I post to do? I'm new to scripting...

0

On line 24, change selectMap() to pickMap(). This probably isn't even your script. If you want to understand scripting, make the scripts yourself.

0

I learned this script from ROBLOX, thank you very much...

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