Error, Output Error (Solved)

So basically I’ve had this error and tried to fix it for 7 months, and it never worked, idk what happened but the message says "BackgroundColor3 is not a valid member of IntValue “Players.YT_PlasaYara.PlayerGui.ScreenGui.Frame.indexMenu.ScrollingFrame.Revolver Gun.difficulty” and I’m gonna need a little help

--- Variables ---
local indexMenu = script.Parent
local collected = indexMenu:WaitForChild("collected")
local scrollingFrame = indexMenu:WaitForChild("ScrollingFrame")
local UIGridLayout = scrollingFrame:WaitForChild("UIGridLayout")
local info = indexMenu:WaitForChild("info")

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

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local gunsFile = ReplicatedStorage:WaitForChild("guns")

local difficultyColours = {
	Color3.fromHex("#26ff00"), -- Easy
	Color3.fromHex("#ffe308"), -- Medium
	Color3.fromHex("#b50003"), -- Hard
	Color3.fromHex("#2600ff"), -- Insane
	Color3.fromHex("#066800"), -- Extreme
	Color3.fromHex("#6702ff") -- Gunerous
}

local difficulties = {
	"Easy",
	"Medium",
	"Hard",
	"Insane",
	"Extreme",
	"Gunerous"
}

local gunsCollected = player:WaitForChild("gunsCollected")

local totalCount = 0
for i, v in pairs(gunsFile:GetChildren()) do
	totalCount = totalCount + 1
end

local collectedCount = 0
for i, v in pairs(gunsFile:GetChildren()) do
	collectedCount = collectedCount + 1
end

collected.Text = collectedCount.."/"..totalCount.." FOUND"

for i, item in pairs(gunsFile:GetChildren()) do
	
	local itemName = item.Name
	local difficulty = item.difficulty.Value
	local hint = item.hint.Value
	local name = item.name.Value
	local image = item.image.Texture
	
	local itemButton = script.templateButton:Clone()
	
	itemButton.Parent = scrollingFrame
	itemButton.Name = itemName
	
	itemButton.Image = image
	itemButton.difficulty.BackgroundColor3 = difficultyColours[difficulty]
	
	if gunsCollected:FindFirstChild(itemName) then
		itemButton.collected.BackgroundTransparency = 1
	else
		itemButton.collected.BackgroundTransparency = 0.65
	end
	
	itemButton.LayoutOrder = difficulty
	UIGridLayout.SortOrder = Enum.SortOrder.LayoutOrder
	UIGridLayout:ApplyLayout()
end
1 Like

Hi can you send what line the error is on?

Yes, right away its line 60

Try testing using color3.fromRgb() (dont edit your current values)

I accidentally edited this before btw ***

So which colours can I put as it?

Try testing using color3.fromRgb() (dont edit your current values)

alr ima go test it out thanks for suggestion

Yeah, as I thought it didn’t work, its a problem with the value.
image
image

Please send the line of code where it errors i dont really know what im looking at sorry

image

What type of value is difficultly i can see your error

image

--- Variables ---
local indexMenu = script.Parent
local collected = indexMenu:WaitForChild("collected")
local scrollingFrame = indexMenu:WaitForChild("ScrollingFrame")
local UIGridLayout = scrollingFrame:WaitForChild("UIGridLayout")
local info = indexMenu:WaitForChild("info")

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

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local gunsFile = ReplicatedStorage:WaitForChild("guns")

local difficultyColours = {
	Color3.fromHex("#26ff00"), -- Easy
	Color3.fromHex("#ffe308"), -- Medium
	Color3.fromHex("#b50003"), -- Hard
	Color3.fromHex("#2600ff"), -- Insane
	Color3.fromHex("#066800"), -- Extreme
	Color3.fromHex("#6702ff") -- Gunerous
}

local difficulties = {
	"Easy",
	"Medium",
	"Hard",
	"Insane",
	"Extreme",
	"Gunerous"
}

local gunsCollected = player:WaitForChild("gunsCollected")

local totalCount = 0
for i, v in pairs(gunsFile:GetChildren()) do
	totalCount = totalCount + 1
end

local collectedCount = 0
for i, v in pairs(gunsFile:GetChildren()) do
	collectedCount = collectedCount + 1
end

collected.Text = collectedCount.."/"..totalCount.." FOUND"

for i, item in pairs(gunsFile:GetChildren()) do
	
	local itemName = item.Name
	local difficulty = item.difficulty.Value
	local hint = item.hint.Value
	local name = item.name.Value
	local image = item.image.Texture
	
	local itemButton = script.templateButton:Clone()
	
	itemButton.Parent = scrollingFrame
	itemButton.Name = itemName
	
	itemButton.Image = image
	itemButton["difficulty"].BackgroundColor3 = difficultyColours[difficulty]
	
	if gunsCollected:FindFirstChild(itemName) then
		itemButton.collected.BackgroundTransparency = 1
	else
		itemButton.collected.BackgroundTransparency = 0.65
	end
	
	itemButton.LayoutOrder = difficulty
	UIGridLayout.SortOrder = Enum.SortOrder.LayoutOrder
	UIGridLayout:ApplyLayout()
end

Okay so your trying to set the backround color of a value which isnt possible, maybe you meant to set the value of a color3 but that wont work.

ima try that alr-

ererwetedgggggggggggggg

idk honestly

eewrrewrrreeeeeeeeeeerrrrr

That sadly doesn’t work.

letter thingerw

instead use @Max_1299’s suggestion and replace FromHex() to FromRGB()

dont forget to replace the values too!

Difficulty doesnt contain a .backgroundcolor3 as its not a frame its a number/int value…

Thats not the issue btw

Fhdhjdjdjdj