“not a frame” is printing because, again, s is a BoolValue and not == to a Frame
so how i can make this? i cant do it myself i dont understand, thanks
Check it. In your for loop. change slot to something else. Because you already define slot and it looks like the gui element in question.
I believe your original code would have worked. Slot was being replaced by the index. But its previous assignment was the gui element you expected.
Please learn the basics of Luau
bro this is a forum if i need help i can create a topic no?
Alright, I’m getting ahead of myself now. Should be more patient with my solutions and responses.
local Ducks = require(game.ReplicatedStorage:WaitForChild("DucksUIHandler"):WaitForChild("Ducks"))
local colors = {
EASY = Color3.fromRGB(25,190,0),
MEDIUM = Color3.fromRGB(255,170,0),
HARD = Color3.fromRGB(170,10,10),
MYTHICHAL = Color3.fromRGB(255,25,225),
LIMITED = Color3.fromRGB(255,255,255),
EXCLUSIVE = Color3.fromRGB(170,85,255),
}
local duckies = game.Players.LocalPlayer.DucksFound:GetChildren()
for _, duck in ipairs(Ducks) do
local slot = game.ReplicatedStorage.DucksUIHandler.Template:Clone()
slot.Parent = script.Parent.Frame.Container
slot.Name = duck.ID
slot.ImageLabel.Image = "rbxthumb://type=Asset&id="..duck.imageID.."&w=420&h=420"
slot.DifficultyLabel.Text = duck.difficulty
slot.Namef.Text = duck.name
slot.DifficultyLabel.BackgroundColor3 = colors[duck.difficulty]
if duckies[_] == true then
slot.BackgroundColor3 = blahblah --backgroundManipulation
else
slot.BackgroundColor3 = blahblah --backgroundManipulation
end
end
Check this bad boy out. I think this will work for you. So I think there was just a confusion on which variables were really being accessed. It looks like you had variables for everything you needed. Just the way you were using them was off.
It looks like you are attempting to assign the BackgroundColor3
property, which is meant for stuff in the player’s GUI. However, you seem to be trying to assign the BackgroundColor3
property to a NumberValue
or an IntValue
. Your for
loop doesn’t even refrence something in the player’s GUI and you are instead looping through NumberValues
or IntValues
Edit: I had realized you are attempting to set the BackgroundColor3
property on the index of the for
loop, which is a number.
That is true, but we are not allowed to give entire scripts to people, only to edit the scripts of those you have already made, which requires knowledge of Luau.
Yes, I understand that you’re coming here asking for help but I suggest you learn some Luau if you want to make a game.
And I agree with @GooberOnTheForums, we can’t just do everything for you. You have to learn.
Agree with both of you. This is part of the learning process though fellas. We get to try to articulate solutions and maybe even bestow some knowledge.
not use r, use the s.:
if s:IsA("Frame) then
Sorry for bother you all, i tried this script, no errors only a warn “PlaceholderRead: (23,13) Placeholder value ‘_’ is read here; consider using a named variable” but now all the frames are red
maybe after this i will go to learn some other basics
Did you use my code? I think sooooo. So yeah just rename _ and u are money bruv.
Also if my code worked maybe mark it as a solution eh?
same, all red backgrounds with no errors
So the problem is that some are supposed to be another color? Make sure you assigned two different color values and you have some duckies that are set to true. Can I get the code again?
Some bool values are true and some false, and yea i will give the code for u now
local Ducks = require(game.ReplicatedStorage:WaitForChild("DucksUIHandler"):WaitForChild("Ducks"))
local colors = {
EASY = Color3.fromRGB(25,190,0),
MEDIUM = Color3.fromRGB(255,170,0),
HARD = Color3.fromRGB(170,10,10),
MYTHICHAL = Color3.fromRGB(255,25,225),
LIMITED = Color3.fromRGB(255,255,255),
EXCLUSIVE = Color3.fromRGB(170,85,255),
}
local duckies = game.Players.LocalPlayer.DucksFound:GetChildren()
for s, duck in ipairs(Ducks) do
local slot = game.ReplicatedStorage.DucksUIHandler.Template:Clone()
slot.Parent = script.Parent.Frame.Container
slot.Name = duck.ID
slot.ImageLabel.Image = "rbxthumb://type=Asset&id="..duck.imageID.."&w=420&h=420"
slot.DifficultyLabel.Text = duck.difficulty
slot.Namef.Text = duck.name
slot.DifficultyLabel.BackgroundColor3 = colors[duck.difficulty]
if duckies[s] == true then
slot.BackgroundColor3 = Color3.new(0,1,0)
else
slot.BackgroundColor3 = Color3.new(1,0,0)
end
end
local Ducks = require(game.ReplicatedStorage:WaitForChild("DucksUIHandler"):WaitForChild("Ducks"))
local colors = {
EASY = Color3.fromRGB(25,190,0),
MEDIUM = Color3.fromRGB(255,170,0),
HARD = Color3.fromRGB(170,10,10),
MYTHICHAL = Color3.fromRGB(255,25,225),
LIMITED = Color3.fromRGB(255,255,255),
EXCLUSIVE = Color3.fromRGB(170,85,255),
}
for _, duck in ipairs(Ducks:GetDescendants()) do
local slot = game.ReplicatedStorage.DucksUIHandler.Template:Clone()
slot.Parent = script.Parent.Frame.Container
slot.Name = duck.ID
slot.ImageLabel.Image = "rbxthumb://type=Asset&id="..duck.imageID.."&w=420&h=420"
slot.DifficultyLabel.Text = duck.difficulty
slot.Namef.Text = duck.name
slot.DifficultyLabel.BackgroundColor3 = colors[duck.difficulty]
for slot, s in ipairs(game.Players.LocalPlayer.DucksFound:GetChildren()) do
if s:IsA(Value Instance Here Ex: "IntValue") and s.Value == true then
slot[s].BackgroundColor3 = Color3.new(0, 1, 0)
else
slot[s].BackgroundColor3 = Color3.new(1, 0, 0)
end
end
end
its supposed to be green to the duck i found so far