I am making a 2048 type of project, and I have all of the valid numbers in a table and it will destroy the object if it is not a valid number. Here is script, I don’t really know how to explain without using script referance.
local Box = script.Parent
local Num = 2
local NS = {2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048}
if Num ~= NS then
Box:Destroy()
end
I have no idea if I’m doing this correct, It runs either way. Tell me if I’m using it right
local Box = script.Parent
local Num = 2
local NS = {2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048}
if Num ~= table.find(NS, Num) then
print(Num)
Box:Destroy()
end
local Box = script.Parent
local Num = 2
local NS = {2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048}
if table.find(NS, Num) then
print(Num)
Box:Destroy()
end
the if statement will run if it finds Num in the table
if you want it to do the opposite then do this