hm? but if I print
print(typeof(colour))
I get Color3?
hm? but if I print
print(typeof(colour))
I get Color3?
are you sure [_-i]
is correct? you’re using v
in the same code
Yes, I created a fill tool that fills it and when I click redo they all go black so I’m positive that its correct
during this, what color is it expected to change to? (1, 0.105, 0.121) is pretty much red
Ah yes this is also what confused me. It is not meant to be red but when I did
it was red.
here’s the whole function
redo.MouseButton1Down:Connect(function()
print(moves)
for _,v in pairs(moves)do
if _==#moves then
local tp = typeof(v)
if tp ~= "number" then
v:Destroy()
moves[_]=nil
else
for i = 1,v do
local colour = moves[_-(v+1)]
print(colour)--prints 1, 0.105882, 0.121569
moves[_-i].Color = colour--part goes black
end
for i = 1,v do
moves[_-i] = nil
end
moves[_-1] = nil
moves[_] = nil
moves[#moves] = nil
print(moves)
end
end
end
end)
usually, you’d use _
as a placeholder if you don’t need it. you should use index
, i
, key
, or k
instead
could I see what the output is showing when you click once?
also, v
is short for value
ye I was using it as placeholder then I changed how I was going to use the function and didn’t go back and I know what they stand for. But here is the output on one click:
-first table is what is started with
-second table values of the ones that were filled with the amount at end and colour at start
-third print is just the colour
-fourth table is after wiping colour value stuff since they should have changed colours
ok, your [5] looks fine
I thought that was a screenshot of your script earlier
now I’m not sure about moves[_-(v+1)]
isnt _=10 and v=10? so this would be moves[-1] on the first try? idk why it’s printing a color
v is the value of 10
v = 4
_ = 10
move[10-5]
= move[5] = the color3
Color3.new(1, 0, 0)
would be red. There’s really no need to be constructing Color3 values with decimal arguments like 0.215686
, round values to the nearest tenth for better readability.
_ is also 10, so wouldnt _-(v+1) be 10-(10+1)?
v = 4
_ = 10
move[10-5]
= move[5] = the color3
the [5] is now around (0.2, 0.1, 1) is it still setting it to black?
Just so you’re aware “_” is typically used in iterations to indicate that it won’t be used. As you’re referencing it within the loop consider renaming it to “i” or “index”.
ye I had a different Idea for the function and got lazy and didn’t change it
if I say
part = Color3.new(colour) its black
part = colour - nothing happens
right now, the Color3 is blue-ish
maybe the part is already blue-ish, so it doesnt show changes?
I’ll just look for a solution on my own, I think you’ve helped enough at this point. I don’t want to be a pain.