Hello, I am trying to change the value of Number which is in the table ( table ) only if the part becomes transparency = 0. Except that it doesn’t work and I don’t understand why, I made some script to show you
local part = workspace.Part
local tables = {["Number"] = 45;}
if part == 0 then
tables["Number"] = tables["Number"] + 6
end
-- or
if part == 0 then
tables.Number = tables.Number + 6
end
the issue with your script is that you are checking if part is equal to 0, which means that part should be a number and be exactly equal to 0. I assume that you meant to check if the transparency of the part is equal to 0 instead. Here’s an updated script that should probably work:
local part = workspace.Part
local tables = {["Number"] = 45;}
if part.Transparency == 0 then
tables["Number"] = tables["Number"] + 6
end
-- or
if part.Transparency == 0 then
tables.Number = tables.Number + 6
end