Still have questions? Join our Discord server and get real time help.
Log in to vote

Trying to make a shovel that digs out terrain?

Asked by 3 days ago
Edited 3 days ago

I'm attempting to make a game based on the Eastern Front, so I'm making a shovel that will allow you to dig out trenches, foxholes, ditches, etc. However, my code is not working.

The explosion just keeps inserting at the center of the map, and nowhere else.

Please Help!

Client Script:

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()

local mouseHit = mouse.Hit.p


Server Script:

--/ Explosion Variables \--
local ex ="Explosion")
ex.ExplosionType = Enum.ExplosionType.Craters
ex.BlastPressure = 100
ex.DestroyJointRadiusPercent = 0
ex.Visible = false
ex.BlastRadius = 10
local debounce = false

--/ Main Function \--
game.ReplicatedStorage.DigTerrain.OnServerEvent:Connect(function(plr, mouseTarget)
    if debounce == false then
        debounce = true
        local exClone = ex:Clone()

        exClone.Position = mouseTarget
        exClone.Parent = workspace
        debounce = false
Yeah i had this idea once. I wanted to do this once but i think i see the problem here, I dont think that you should use mouseHit.p as you are passing a Vector3 and not a mouse. kepiblop 36 — 3d
And should probably put a player variable beside mouseHit on the server script on line 11 kepiblop 36 — 3d
Ok, Thanks! Louscascicly 0 — 3d
your welcome! And also i kind of got a bit inspiration from this so thank you too! kepiblop 36 — 3d
View all comments (3 more)
did it work? The pos variable shouldn't be there and also uhh localplayer cannot be called on server script s Andput it like this :Connect(function(player,mouseTarget) and you should also just use mouseTarget instead of wrapping it in a vector3 like this exClone.Position = mouseTarget kepiblop 36 — 3d
It still only inserts at the center of the map. I did everything you said to do. Louscascicly 0 — 3d
Nvm, i fixed it, thank you! Louscascicly 0 — 2d

Answer this question