Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Terrain wont trigger comparison check?

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?

1 answer

Using

if cm.Value~=tty then

returned the exact value of the enum..

This discussion is preserved as it was. New answers, comments, and votes are closed.