Script doesn't work for some reason

I’ve been recently trying to make it work only with specific terrain materials, however, now it just doesn’t dig, what the problem could be in?


local AcceptedMaterialTable = {Enum.Material.Grass,
	Enum.Material.Snow,
	Enum.Material.LeafyGrass,
	Enum.Material.Sand}

local function CheckMaterial(Object)
	for _,Value in pairs(AcceptedMaterialTable) do
		if Value == Object.Material then
			return true
		end
	end
	workspace.Terrain:FillBlock(CFrame.new,Vector3.new(7,7,7),--[[mouse.Material]]Enum.Material.Air)
	return false
end

It appears that the material table that is accepted is causing it to return. I’m not sure if this is intentional.

Additionally, CFrame.new is not a CFrame, it is a function:

1 Like
local AcceptedMaterialTable = {
    Enum.Material.Grass,
	Enum.Material.Snow,
	Enum.Material.LeafyGrass,
	Enum.Material.Sand
}

local function CheckMaterial(Object)
	for _,Value in pairs(AcceptedMaterialTable) do
		if Value == Object.Material then
			return true
		end
	end

	workspace.Terrain:FillBlock(Vector3.new(7,7,7), 5, Enum.Material.Air)

	return false
end
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.