Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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)

0
put the script in a code block SteamG00B 1633 — 5y
0
as for material types, that would be Enum.Material SteamG00B 1633 — 5y

1 answer

Log in to vote
0
Answered by
SteamG00B 1633 Moderation Voter
5 years ago
Edited 5 years ago
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.

0
But it wont work... Deinonychusaurus 21 — 5y
Ad

Answer this question