For context, I’m making a card game, and for graphical effect, whenever a card is selected, I want the border to change to the settings below. I used a combination of CollectionService, Special UI mods, and stacking UI together to make the system. I am certain everything else works, but the one line.
Everything works in my code, but the only thing that doesn’t work is the
card.UIStroke.Color = Color3.FromRGB(x, y, z) lines. Changing the Color manually and ingame does work.
Code is below:
local cs = game:GetService("CollectionService")
for _, card in pairs(cs:GetTagged("Card")) do
local cardSelected = false
local function deselectCard(card)
card.UIStroke.Color = Color3.FromRGB(254, 254, 254)
card.UIStroke.Transparency = 0.8
for _, v in ipairs(board["noob"]) do
v.model_display.Material = "Plastic"
end
end
local function selectCard(card)
card.UIStroke.Color = Color3.FromRGB(255, 183, 0)
card.UIStroke.Transparency = 0
for _, v in ipairs(board["noob"]) do
v.model_display.Material = "Neon"
end
end
card.Activated:Connect(function()
for _, v in pairs(cs:GetTagged("Card")) do
deselectCard(v)
end
if cardSelected then
selectCard(card)
cardSelected = false
else
cardSelected = true
end
end)
end
I get this error:
Players.arandomfatkid.PlayerGui.noob_hand.uivisuals:46: attempt to call a nil value
Line 46 is the Color3.FromRGB line.
Anyone know if I just wrote the line wrong or something? Not getting any errors asides from the output.