With this code
cmtype=math.random(0,7) ter=workspace.Terrain function setcel(z) local cm=ter:GetCell(z.X,z.Y,z.Z) if cm~=tty then print("heycells") print(cm,tty) ter:SetCell(z.X,z.Y,z.Z,tty,0,0) end end
No matter what, even if the set cell at the z position IS that terrain type, it passes the if statement and sets the cell.
The output is heycells Enum.CellMaterial.Gravel 11
Is there a way to turn the CellMaterial Enum to a raw Value Number?
Using
if cm.Value~=tty then
returned the exact value of the enum..