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)
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.
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.
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
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.