Function is Printing Nothing

Hello, I ran into a problem where I run a function and it checks what world I am in and it prints a certain number. Here is the script, any help is appreciated.

local function getData(Worlds)
	local fVar = ""
	local Data = {
		["1"] = "2500", -- ["1"] Number of World | "2500" Number that should be printed out.
		["2"] = "13500",
	if Worlds == 1 then
		fVar = Data["1"]
	if Worlds == 2 then
		fVar = Data["2"]
local function boughtMap()


--// Connect Functions

1 Like

The output is just " ". Not sure why but yeah

When I test it, It seems to run fine. What is the value of “Player:WaitForChild(“MapWorld”).Value”?


World Type, its currently at 1.

Wait is it because it’s not a string value? It’s an int value.

I wouldn’t think so, your code checks for integers, not strings.
Try printing out its value in the boughtMap() function.

1 Like

You might also want to use tonumber() because your code says it doesn’t equal 1 or 2.

1 Like

Ah I found the solution, the value was a string value. In my IF statement, I referred it to an integer so the script must have gotten confused and came out with nil.

1 Like

Thanks for the help! I appreciate it very much

1 Like