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

I made this dig script but it wont work and do how do i say material types?

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)

2 comments

0

put the script in a code block

0

as for material types, that would be Enum.Material

1 answer

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.

1 comment

0

But it wont work...

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