So i made a script that gets a brickcolor from a table using an index, but it doesnt work, as when i return the value and try to print it, a blank space appears in ouput.
heres the function
local function getBrickColorFromIndex(num: int)
local brickColors = {
BrickColor.new("Red flip/flop"),
BrickColor.new("Really red"),
BrickColor.new("Really blue"),
BrickColor.new("Black metallic"),
BrickColor.new("Grey"),
BrickColor.new("Slime green")
}
for i,v:BrickColor in pairs(brickColors) do
if num == i then
return brickColors[i]
end
end
end
local function decodeBallCode(code:string)
local NewCode = string.split(code,".")
print(NewCode[1])
print(getBrickColorFromIndex(NewCode[1]))
return {getBrickColorFromIndex(NewCode[1]),getMaterialFromIndex(NewCode[2]),NewCode[3]}
end
Any issue im not seeing?
also an error from another part of the script
local translatedValues = decodeBallCode(v)
clone.BrickColor = translatedValues[1]