3 is not a valid member of Folder "Workspace.Maps.Easy" error

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to achieve a working map picker system. How the system works is that once a player click a specific button, the script will add the maps on a specific folder. Players can choose the maps by clicking next and previous.

  2. What is the issue? Include screenshots / videos if possible!

image

  1. What solutions have you tried so far?
    So far I tried GetPropertyChangedSignal and Changed function and still need to find another solution
local easy = game.Workspace.Buttons.Easy_Button
local medium = game.Workspace.Buttons.Medium_Button
local sin1 = game.Workspace.Buttons.SingleNext_1
local sin2 = game.Workspace.Buttons.SinglePrev_1
local back3 = game.Workspace.Buttons.Back3
local player = game.Players.LocalPlayer

for _,v in pairs(workspace.Maps:GetChildren()) do
	local template = game.Workspace.MapPlaceholder1
	local playbutton = game.Workspace.Buttons.JoinButton_1

	finished = nil
	local num = 1
	local maps = game.Workspace.Maps

	local function getDectector(button, difficulty)
		local limit = script.Limits[difficulty]
		local child = game.Workspace.Maps[difficulty]:GetChildren()
		
		limit.Value = #child
		local str = script.Sin
		
		button.ClickDetector.MouseClick:Connect(function(plr) -- Map add when press a specific button
			if v:IsA("Folder") then
				if v.Name == difficulty then
					str.Value = difficulty
					if limit.Value == 1 then
						sin1.ClickDetector.MaxActivationDistance = 0
						sin2.ClickDetector.MaxActivationDistance = 0
						sin1.Transparency = 1
						sin2.Transparency = 1
					else
						sin1.ClickDetector.MaxActivationDistance = 10000
						sin2.ClickDetector.MaxActivationDistance = 10000
						sin1.Transparency = 0.5
						sin2.Transparency = 0.5
					end
					template.Creator.SurfaceGui.SIGN.Text = "By: "..v[num].Creator.Value
					template.MapDifficulty.SurfaceGui.SIGN.Text = v[num].Difficulty.Value
					template.MapImage.Decal.Texture = v[num].MapImage.Texture
					template.MapName.SurfaceGui.SIGN.Text = v[num].MapName.Value
					template.TotalRooms.SurfaceGui.SIGN.Text = v[num].TotalRooms.Value.." Rooms"
					playbutton.JoinValue.Value = v[num].PlayID.Value
				end
			end
		end)
				
		sin1.ClickDetector.MouseClick:Connect(function(plr) -- Preview Next
			if v:IsA("Folder") then
				str:GetPropertyChangedSignal("Value"):Connect(function()
					if v.Name == str.Value then
						num = num +1					
						if num > limit.Value then
							num = 1	
						end
						template.Creator.SurfaceGui.SIGN.Text = "By: "..v[num].Creator.Value
						template.MapDifficulty.SurfaceGui.SIGN.Text = v[num].Difficulty.Value
						template.MapImage.Decal.Texture = v[num].MapImage.Texture
						template.MapName.SurfaceGui.SIGN.Text = v[num].MapName.Value
						template.TotalRooms.SurfaceGui.SIGN.Text = v[num].TotalRooms.Value.." Rooms"
						playbutton.JoinValue.Value = v[num].PlayID.Value
					end
				end)
			end
		end)

		sin2.ClickDetector.MouseClick:Connect(function(plr) -- Preview Previous
			if v:IsA("Folder") then
				str:GetPropertyChangedSignal("Value"):Connect(function()
					if v.Name == str.Value then
						num = num -1
						if num < 1 then
							num = limit.Value
						end
						template.Creator.SurfaceGui.SIGN.Text = "By: "..v[num].Creator.Value
						template.MapDifficulty.SurfaceGui.SIGN.Text = v[num].Difficulty.Value
						template.MapImage.Decal.Texture = v[num].MapImage.Texture
						template.MapName.SurfaceGui.SIGN.Text = v[num].MapName.Value
						template.TotalRooms.SurfaceGui.SIGN.Text = v[num].TotalRooms.Value.." Rooms"
						playbutton.JoinValue.Value = v[num].PlayID.Value
					end
				end)
			end
		end)
		return button, difficulty
	end
	
	back3.ClickDetector.MouseClick:Connect(function()
		num = 1
	end)
	
	getDectector(easy, "Easy")
	getDectector(medium, "Medium")
end

Thank you!

You will need to convert the number to a string in all the lines where you are trying to access the folder, for example here:

template.Creator.SurfaceGui.SIGN.Text = "By: "..v[num].Creator.Value

You will need to change the code to

template.Creator.SurfaceGui.SIGN.Text = "By: "..v[tostring(num)].Creator.Value


That doesn’t work but I appreciate the help.

Can you add this script before
template.Creator.SurfaceGui.SIGN.Text = "By: "..v[num].Creator.Value

This script:

for _,__ in pairs(v:GetChildren()) do
	print(__.name)
end

And tell me what print out

Exactly bro there isn’t a 3 in the easy folder

The medium folder does indeed have 3 in it but Easy Does not

Or maybe i didnt understand anything iam so confused lol

I found a issue for your script It check if 3 is in your map or not:

local easy = game.Workspace.Buttons.Easy_Button
local medium = game.Workspace.Buttons.Medium_Button
local sin1 = game.Workspace.Buttons.SingleNext_1
local sin2 = game.Workspace.Buttons.SinglePrev_1
local back3 = game.Workspace.Buttons.Back3
local player = game.Players.LocalPlayer

for _,v in pairs(workspace.Maps:GetChildren()) do
	local template = game.Workspace.MapPlaceholder1
	local playbutton = game.Workspace.Buttons.JoinButton_1

	finished = nil
	local num = 1
	local maps = game.Workspace.Maps

	local function getDectector(button, difficulty)
		local limit = script.Limits[difficulty]
		local child = game.Workspace.Maps[difficulty]:GetChildren()

		limit.Value = #child
		local str = script.Sin

		button.ClickDetector.MouseClick:Connect(function(plr) -- Map add when press a specific button
			if v:IsA("Folder") then
				if v.Name == difficulty and (v:FindFirstChild(num) or v:FindFirstChild(tostring(num)))  then
					str.Value = difficulty
					if limit.Value == 1 then
						sin1.ClickDetector.MaxActivationDistance = 0
						sin2.ClickDetector.MaxActivationDistance = 0
						sin1.Transparency = 1
						sin2.Transparency = 1
					else
						sin1.ClickDetector.MaxActivationDistance = 10000
						sin2.ClickDetector.MaxActivationDistance = 10000
						sin1.Transparency = 0.5
						sin2.Transparency = 0.5
					end
					template.Creator.SurfaceGui.SIGN.Text = "By: "..v[num].Creator.Value
					template.MapDifficulty.SurfaceGui.SIGN.Text = v[num].Difficulty.Value
					template.MapImage.Decal.Texture = v[num].MapImage.Texture
					template.MapName.SurfaceGui.SIGN.Text = v[num].MapName.Value
					template.TotalRooms.SurfaceGui.SIGN.Text = v[num].TotalRooms.Value.." Rooms"
					playbutton.JoinValue.Value = v[num].PlayID.Value
				end
			end
		end)

		sin1.ClickDetector.MouseClick:Connect(function(plr) -- Preview Next
			if v:IsA("Folder") then
				str:GetPropertyChangedSignal("Value"):Connect(function()
					if v.Name == str.Value and (v:FindFirstChild(num) or v:FindFirstChild(tostring(num))) then
						num = num +1					
						if num > limit.Value then
							num = 1	
						end
						template.Creator.SurfaceGui.SIGN.Text = "By: "..v[num].Creator.Value
						template.MapDifficulty.SurfaceGui.SIGN.Text = v[num].Difficulty.Value
						template.MapImage.Decal.Texture = v[num].MapImage.Texture
						template.MapName.SurfaceGui.SIGN.Text = v[num].MapName.Value
						template.TotalRooms.SurfaceGui.SIGN.Text = v[num].TotalRooms.Value.." Rooms"
						playbutton.JoinValue.Value = v[num].PlayID.Value
					end
				end)
			end
		end)

		sin2.ClickDetector.MouseClick:Connect(function(plr) -- Preview Previous
			if v:IsA("Folder") then
				str:GetPropertyChangedSignal("Value"):Connect(function()
					if v.Name == str.Value and (v:FindFirstChild(num) or v:FindFirstChild(tostring(num))) then
						num = num -1
						if num < 1 then
							num = limit.Value
						end
						template.Creator.SurfaceGui.SIGN.Text = "By: "..v[num].Creator.Value
						template.MapDifficulty.SurfaceGui.SIGN.Text = v[num].Difficulty.Value
						template.MapImage.Decal.Texture = v[num].MapImage.Texture
						template.MapName.SurfaceGui.SIGN.Text = v[num].MapName.Value
						template.TotalRooms.SurfaceGui.SIGN.Text = v[num].TotalRooms.Value.." Rooms"
						playbutton.JoinValue.Value = v[num].PlayID.Value
					end
				end)
			end
		end)
		return button, difficulty
	end

	back3.ClickDetector.MouseClick:Connect(function()
		num = 1
	end)

	getDectector(easy, "Easy")
	getDectector(medium, "Medium")
end

it didn’t work. Still same error

Copy the Medium Folder Number 3 Children. Paste into Easy Folder. Does the error show up again?
image

I actually dont want them to be equally the same children as other folders.

1 Like

You didn’t check either the children 3 even exist in Easy folder. That why it show out that error.

1 Like

From the screenshots I have seen, 3 is not parented to the easy folder.

I just realize I actually put the next and previous button functions in a local function instead of putting them outside which cause the script to break.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.