so i wrote this but its not working it works fine without the sand.materiel but i have have people digging in water code: script.Dig_event.OnServerEvent:Connect(function(p,data) local recordedPosition = game.Workspace.Terrain.Material.Sand:WorldToCellPreferSolid(data) if game.Workspace.Terrain.Material.Sand:WorldToCellPreferSolid(data) ~= recordedPosition then return end game.Workspace.Terrain.Material.Sand:SetCell(recordedPosition.X,recordedPosition.Y,recordedPosition.Z,0,0,0) end)
local terrain = game.Workspace.Terrain script.Dig_event.OnServerEvent:Connect(function(p,data) local recordedPosition = terrain.Material.Sand:WorldToCellPreferSolid(data) terrain.Material.Sand:SetCell(recordedPosition.X,recordedPosition.Y,recordedPosition.Z,0,0,0) end)
You check if a value you just set is not equal to itself, so that just isn't needed at all. And also, this looks messy, but if you view source, it'll be easier to read.