"Folder" is not a vaild member of Player

Hey guys, Why this this does not work, there is the same folder in the player as in the script!

local button = workspace.Buttonsim.Buttonsfolder
local function buttonvalue(player)
	if player then
		print(player)
		local buttonfolder = player.ButtonsFolder
		print(buttonfolder)
		if buttonfolder then
			if buttonfolder.Button2.Value == true then
				button.Buttons2.Barrierb3.Transparency = 1
				button.Buttons2.Barrierb3.CanCollide = false
			end
			if buttonfolder.Button3.Value == true then
				button.Buttons3.Barrierb3.Transparency = 1
				button.Buttons3.Barrierb3.CanCollide = false
			end
			
			if buttonfolder.Button4VIP.Value == true then
				button["Buttons4-VIP"].Barrierb3.Transparency = 1
				button["Buttons4-VIP"].Barrierb3.CanCollide = false
			end
			if buttonfolder.Button5.Value == true then
				button.Buttons5.Barrierb3.Transparency = 1
				button.Buttons5.Barrierb3.CanCollide = false
			end
			if buttonfolder.Button5VIP.Value == true then
				button["Buttons5-VIP"].Barrierb3.Transparency = 1
				button["Buttons5-VIP"].Barrierb3.CanCollide = false
			end
			
			if buttonfolder.Button6.Value == true then
				button.Buttons6.Barrierb3.Transparency = 1
				button.Buttons6.Barrierb3.CanCollide = false
			end
			if buttonfolder.Button6VIP.Value == true then
				button["Buttons6-VIP"].Barrierb3.Transparency = 1
				button["Buttons6-VIP"].Barrierb3.CanCollide = false
			end
			if buttonfolder.Button7VIP.Value == true then
				button["Buttons7-VIP"].Barrierb3.Transparency = 1
				button["Buttons7-VIP"].Barrierb3.CanCollide = false
			end
			if buttonfolder.Button8.Value == true then
				button.Buttons8.Barrierb3.Transparency = 1
				button.Buttons8.Barrierb3.CanCollide = false
			end
			if buttonfolder.Button8VIP.Value == true then
				button["Buttons8-VIP"].Barrierb3.Transparency = 1
				button["Buttons8-VIP"].Barrierb3.CanCollide = false
			end
			if buttonfolder.Button9.Value == true then
				button.Buttons9.Barrierb3.Transparency = 1
				button.Buttons9.Barrierb3.CanCollide = false
			end
			if buttonfolder.Button9VIP.Value == true then
				button["Buttons9-VIP"].Barrierb3.Transparency = 1
				button["Buttons9-VIP"].Barrierb3.CanCollide = false
			end
			if buttonfolder.Button10VIP.Value == true then
				button["Buttons10-VIP"].Barrierb3.Transparency = 1
				button["Buttons10-VIP"].Barrierb3.CanCollide = false
			end
			if buttonfolder.Button11.Value == true then
				button.Buttons11.Barrierb3.Transparency = 1
				button.Buttons11.Barrierb3.CanCollide = false
			end
			if buttonfolder.Button11VIP.Value == true then
				button["Buttons11-VIP"].Barrierb3.Transparency = 1
				button["Buttons11-VIP"].Barrierb3.CanCollide = false
			end
			if buttonfolder.Button12.Value == true then
				button.Buttons12.Barrierb3.Transparency = 1
				button.Buttons12.Barrierb3.CanCollide = false
			end
			if buttonfolder.Button12VIP.Value == true then
				button["Buttons12-VIP"].Barrierb3.Transparency = 1
				button["Buttons12-VIP"].Barrierb3.CanCollide = false
			end
			
		end
	end	
end
game.Players.PlayerAdded:Connect(buttonvalue)
4 Likes

is the “Folder” supposed to be capitalized? if not then that’s probably your answer since I make the mistake of capitalizing stuff a lot and figuring out why it broke just to realize that I typed it wrong.

1 Like

the ButtonsFolder is capital while in buttonsim it is small

1 Like

alright, ill continue going over it then.

Where does it error in particular? line #5?

1 Like

Idk
btw this is the error i am getting

1 Like

What if you change line 5 to:

local buttonfolder = player:WaitForChild("ButtonsFolder")
2 Likes

let’s see maybe it might be the problem because the buttonfolder gets created after few seconds!

1 Like

I was going to mention this since I know sometimes that the script will load in faster before the player does depending how it’s written, let alone the stuff added to the player.

1 Like

yeah but now it is saying that Button2 is not a valid member of Folder “Players.colourfullsteve08.ButtonsFolder”

1 Like

How does the Values spawn in?

You might need to put a wait.

		local buttonfolder = player:WaitForChild("ButtonsFolder")
		print(buttonfolder)
wait()--sometimes just assigning a wait like this will work, but it depends on the script adding the value instances.
		if buttonfolder then
			if buttonfolder.Button2.Value == true then
1 Like

Have you got another script inserting the “ButtonsFolder” folder into the player?

1 Like

yes it is there,
But does it relate with it?

1 Like

It does relate, if the script hasn’t finished creating the values for your folder, the other script can just run and error seeing it doesn’t exist yet.

What you could also do is just delay your script from running until stuff is fully finished loading in.

1 Like

nope the wait didn’;t work out i think waitfor child might be

1 Like

Can we see the other script then?

You can also give it 5 seconds as a sanity check. I should’ve added that originally tbh.

1 Like

Not sure if this works because I haven’t tried it before but I believe using task.wait() is better than using wait() right?

2 Likes

It is more efficient from what I understand.

1 Like

it is quite long because of the datastore

	-- when the button is purchased it will chaneg the value coresponding
	local button2 = Instance.new("BoolValue")
		button2.Name = "Button2"
		button2.Value = false
	button2.Parent = buttonfolder
	
	local button3 = Instance.new("BoolValue")
		button3.Name = "Button3"
		button3.Value = false
	button3.Parent = buttonfolder
	
	
	local button5= Instance.new("BoolValue")
		button5.Name ="Button5"
	    button5.Value=false
	button5.Parent=buttonfolder
	
	local button6 = Instance.new("BoolValue")
		button6.Name = "Button6"
		button6.Value = false
	button6.Parent = buttonfolder
	
	
	
	local button8= Instance.new("BoolValue")
		button8.Name ="Button8"
	    button8.Value=false
	button8.Parent=buttonfolder
		
	local button9= Instance.new("BoolValue")
		button9.Name ="Button9"
	    button9.Value=false
	button9.Parent=buttonfolder

	
	local button11 = Instance.new("BoolValue")
		button11.Name = "Button11"
		button11.Value = false
	button11.Parent = buttonfolder
	
	local button12= Instance.new("BoolValue")
		button12.Name ="Button12"
	    button12.Value=false
	button12.Parent=buttonfolder
	

	local button4VIP = Instance.new("BoolValue")
	button4VIP.Name = "Button4VIP"
	button4VIP.Value = false
	button4VIP.Parent = buttonfolder
	
	local button7VIP = Instance.new("BoolValue")
	button7VIP.Name = "Button7VIP"
	button7VIP.Value = false
	button7VIP.Parent = buttonfolder
	
	local button5VIP =  Instance.new("BoolValue")
	button5VIP.Name = "Button5VIP"
	button5VIP.Value = false
	button5VIP.Parent = buttonfolder
	
	local button6VIP =  Instance.new("BoolValue")
	button6VIP.Name = "Button6VIP"
	button6VIP.Value = false
	button6VIP.Parent = buttonfolder
	
	local button8VIP= Instance.new("BoolValue")
		button8VIP.Name ="Button8Vip"
	    button8VIP.Value=false
	button8VIP.Parent=buttonfolder
		
	local button9Vip= Instance.new("BoolValue")
		button9Vip.Name ="Button9Vip"
	    button9Vip.Value=false
	button9Vip.Parent=buttonfolder
		
	local button10vip =  Instance.new("BoolValue")
		button10vip.Name ="Button10Vip"
	    button10vip.Value=false
	button10vip.Parent= buttonfolder 
	
	local button11VIP =  Instance.new("BoolValue")
		button11VIP.Name = "Button11Vip"
		button11VIP.Value = false
	button11VIP.Parent = buttonfolder
	
	local button12VIP= Instance.new("BoolValue")
		button12VIP.Name ="Button12Vip"
	    button12VIP.Value=false
	button12VIP.Parent=buttonfolder
1 Like

oh hmm, could we see the script that loads the folder into the player?

1 Like

Could we see the part above that which loads the buttonFolder?

1 Like