I made a script but it doesn't work

I made a script so that if the currency value is 0, then another text is visible, and if the value is 1, then another. The error in the console is that the script cannot find the folder in the player, although it exists and I did :WaitForChild

local player = game:GetService("Players")
local localPlayer = player.LocalPlayer
local blackList = localPlayer:WaitForChild("BankFolder").BlackList.Value

if blackList == 0 then
	script.Parent.Visible = false
	script.Parent.Parent.NoBlackList.Visible = true
elseif blackList == 1 then
	script.Parent.Visible = true
	script.Parent.Parent.NoBlackList.Visible = false
end

Context

  • Is this a local script?
  • Show us the player hierarchy in a screenshot

Try this:

local players = game:GetService("Players")
local player = players.LocalPlayer

local bankFolder = player:WaitForChild("BankFolder")
local blacklistValue = bankFolder:FindFirstChild("BlackList").Value

local noBlackListUI = script.Parent.Parent.NoBlackList

if blackListValue == 0 then
	script.Parent.Visible = false
	noBlackListUI.Visible = true
elseif blackListValue == 1 then
	script.Parent.Visible = true
	noBlackListUI.Visible = false
end

Also what @ithacaTheEnby said.

this local script.
player hierarchy in service Players?

Show us the explorer. Also where are you creating the folder?

I creating folder with value in player.

??? What do you mean? Please show the explorer.

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