Help with my digging script(Unsolved)

Hey fellow developers I making a pickaxe for my game but I only want it to apply to a certain kind of terrain like rock. Can someone tell my how I would do that?

game.ReplicatedStorage.Events.ToolEvents.DigEvent.OnServerEvent:Connect(function(player, MouseTarget)
if (player.Character.PickAxe.Handle.Position - MouseTarget).magnitude < 12 then
	local Explosion = Instance.new("Explosion")
	Explosion.Parent = workspace
	Explosion.BlastPressure = 6
	Explosion.BlastRadius = 5
	Explosion.DestroyJointRadiusPercent = 0
	Explosion.ExplosionType = Enum.ExplosionType.Craters
	Explosion.Visible = false
	Explosion.Position = MouseTarget
end

end)

This isn’t possible without using the Roblox terrain API (manually)

https://developer.roblox.com/en-us/api-reference/class/Terrain

1 Like