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

Players are limited with in-game digging? Help and how to remove?

Asked by
A_Mp5 222 Moderation Voter
2 years ago

Hi! I'm a developer of a game! The game has a digging ability whereas when you press F you dig a cursor CFrame and G to build. Building works perfectly, but for some reason, players can dig freely but there seems to be some sort of limit, where they cannot dig past or on. I never implemented a limit, and there is no brick at that level.

Game: https://web.roblox.com/games/8126356686/Fire-Ants-Beta

Server:


local bsize = 4.5 local size = 7 game.ReplicatedStorage:WaitForChild("Construct").OnServerEvent:Connect(function(player,ct,position) if (position-player.Character.HumanoidRootPart.Position).Magnitude < 30 then if ct == true then workspace.Terrain:FillRegion(Region3.new(Vector3.new(position.X - bsize/2, position.Y - bsize/2, position.Z - bsize/2), Vector3.new(position.X + bsize/2, position.Y + bsize/2, position.Z + bsize/2)), 4, Enum.Material.Mud) elseif ct ==false then workspace.Terrain:FillRegion(Region3.new(Vector3.new(position.X - size/2, position.Y - size/2, position.Z - size/2), Vector3.new(position.X + size/2, position.Y + size/2, position.Z + size/2)), 4, Enum.Material.Air) end end end)

Client:

local function action(k,p)
    if k ~= nil and p~= nil then
        if k == Enum.KeyCode.F and db == true and not p then

            db = false
            game.ReplicatedStorage.Construct:FireServer(false,ms.Hit.Position)
            local newcf = ms.Hit + ms.Hit.lookVector * 2.5
            game.ReplicatedStorage.Construct:FireServer(false,newcf.Position)

            wait(s)
            db = true
        elseif k == Enum.KeyCode.G and db == true and not p  then

            db = false
            game.ReplicatedStorage.Construct:FireServer(true,ms.Hit.Position)
            local newcf = ms.Hit - ms.Hit.lookVector / 2.5
            game.ReplicatedStorage.Construct:FireServer(true,newcf.Position)
            wait(s)
            db = true
        end
    end
end
uis.InputBegan:Connect(function(k,p)
    ac

Answer this question