local U=script.Parent local C=game.Players.LocalPlayer local y=C:GetMouse()local L=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")local v=U:WaitForChild("\072\097\110\100\108\101")local e=v:WaitForChild("\065\108\108\111\119\080\108\097\099\101\109\101\110\116")local P;(U:WaitForChild("\082\101\109\111\116\101\070\117\110\099\116\105\111\110")).OnClientInvoke=function(...)return y.Target,y.Hit.p end local i U.Equipped:Connect(function()i=L.InputBegan:Connect(function(C,L)if L then return end if not e.Value then return end if C.UserInputType==Enum.UserInputType.Keyboard then if C.KeyCode==Enum.KeyCode.E then(U:WaitForChild("\082\101\109\111\116\101\069\118\101\110\116")):FireServer(y.Target,y.Hit.p)end end end)end)U.Unequipped:Connect(function()if not e.Value then return end i:Disconnect()i=nil end);(U:WaitForChild("\082\101\109\111\116\101\069\118\101\110\116")).OnClientEvent:Connect(function(U,C)P=U if C then P.TextLabel.Text="\083\111\105\108\058 "..C end end)
-- Shovel - Client Controls @ JDLENL 3/22/20
-- If you use this in your game, consider mentioning me in the description! I'd appreciate it.

local Tool = script.Parent
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local UIS = game:GetService("UserInputService")
local Handle = Tool:WaitForChild("Handle")
local CanPlace = Handle:WaitForChild("AllowPlacement")
local GUI

Tool:WaitForChild("RemoteFunction").OnClientInvoke = function(...)
	return Mouse.Target, Mouse.Hit.p
end

local _C

Tool.Equipped:Connect(function()
	_C = UIS.InputBegan:Connect(function(Input, GPE)
		if GPE then
			return
		end
		if not CanPlace.Value then
			return
		end
		if Input.UserInputType == Enum.UserInputType.Keyboard then
			if Input.KeyCode == Enum.KeyCode.E then
				Tool:WaitForChild("RemoteEvent"):FireServer(Mouse.Target, Mouse.Hit.p)
			end
		end
	end)
end)

Tool.Unequipped:Connect(function()
	if not CanPlace.Value then
		return
	end
	_C:Disconnect()
	_C = nil
end)

Tool:WaitForChild("RemoteEvent").OnClientEvent:Connect(function(Gui, SoilCount)
	GUI = Gui
	if SoilCount then
		GUI.TextLabel.Text = "Soil: " .. SoilCount
	end
end)
