I’ve built a simple dig tool that players can use to find boxes that are hidden underground in smooth terrain. The issue originally was that it was too dark underground, so I made the activation of the tool turn off global shadows for the player. That fixed the darkness issue, but it gave the digging another problem. It seems for some clicks that the terrain lags slightly when trying to fill with air and you can temporarily see all the boxes underground with x-ray vision! I tried putting a pointlight on the player’s head instead of turning off the shadows but you can still see them pretty clearly. Is there a better way to be editing the terrain? The problem seems to persist even when using ReplaceMaterial instead of FillBlock
LocalScript
script.Parent.Deactivated:connect(function()
local hum = game.Players.LocalPlayer.Character.Humanoid
local target = hum.TargetPoint
script.Parent.RemoteEvent:FireServer(target)
end)
--make underground visible
script.Parent.Equipped:Connect(function()
game.Lighting.GlobalShadows = false
end)
script.Parent.Unequipped:Connect(function()
if game.Players.LocalPlayer.Character.Head.Position.Y > game.Workspace.Baseplate.Baseplate.Position.Y then
game.Lighting.GlobalShadows = true
end
end)
Script:
script.Parent.RemoteEvent.OnServerEvent:Connect(function(player,target)
if player.Character.Head.Position.Y > workspace.Baseplate.Baseplate.Position.Y then
game.Workspace.Terrain:FillBlock(CFrame.new(target)*CFrame.new(0,-10,0),Vector3.new(10,10,10),Enum.Material.Air) -- fixes buggy digging at entrance
else
game.Workspace.Terrain:FillBlock(CFrame.new(target),Vector3.new(10,10,10),Enum.Material.Air)
end
end)