Still have questions? Join our Discord server and get real time help.
0

# Trying to make a shovel that digs out terrain?

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.

Client Script:

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

local mouseHit = mouse.Hit.p

script.Parent.Activated:Connect(function()
game.ReplicatedStorage.DigTerrain:FireServer(mouseHit)
end)


Server Script:

--/ Explosion Variables \--
local ex = Instance.new("Explosion")
ex.ExplosionType = Enum.ExplosionType.Craters
ex.BlastPressure = 100
ex.Visible = false
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
wait(0.5)
debounce = false
end
end)

0
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
0
And should probably put a player variable beside mouseHit on the server script on line 11 kepiblop 36 — 3d
0
Ok, Thanks! Louscascicly 0 — 3d
0
your welcome! And also i kind of got a bit inspiration from this so thank you too! kepiblop 36 — 3d