Unable to cast double to token Error

im getting an error with this script

mouse = game.Players.LocalPlayer:GetMouse()
down = false
mouse.Button1Down:connect(function ()
	down = true
	mouse.Button1Up:connect(function ()
		down = false
	end)
	local recordedPosition = game.Workspace.Terrain:WorldToCellPreferSolid(mouse.Hit.p)
	for i = 1,2 do
		if game.Workspace.Terrain:WorldToCellPreferSolid(mouse.Hit.p) ~= recordedPosition then
			return 
		end
		if down == false then
			return 
		end
		wait()
	end
-- this line ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
game.Workspace.Terrain:SetCell(recordedPosition.X,recordedPosition.Y,recordedPosition.Z,4,4,4) -- here is the error
end)

This feature is deprecated. Anyways the last 3 parameters you’re passing in for Terrain:SetCell have the wrong types. They need to be Enum types: CellMaterial, CellBlock and CellOrientation respectively.

2 Likes

@Xx_FROSTBITExX how do i do Use that like Terrain.Enum?

so do i use Terrain:FillBlock() ?

No you would use those 3 enums.

game.Workspace.Terrain:SetCell(recordedPosition.X,recordedPosition.Y,recordedPosition.Z,Enum.CellMaterial.Asphalt,Enum.CellBlock.Solid,Enum.CellOrientation.X)