Mining Game System with a Pickaxe

This is the script using Raycast and User Input Service with a range system

local UserInputService = game:GetService("UserInputService")
local Range = 10
local Folder = workspace -- Your block's folder

UserInputService.InputBegan:Connect(function(Input, Interact)
	
	if not Interact and not game.Players.LocalPlayer.Character:FindFirstChild("pickaxe") and Input.UserInputType == Enum.UserInputType.MouseButton1 then
		
		local ViewPoint, Param = workspace.CurrentCamera:ViewportPointToRay(UserInputService:GetMouseLocation().X, UserInputService:GetMouseLocation().Y), RaycastParams.new()
		Param.FilterType, Param.FilterDescendantsInstances = Enum.RaycastFilterType.Include, {Folder}
		
		local Raycast = workspace:Raycast(ViewPoint.Origin, ViewPoint.Direction * 10000, Param)
		
		if (game.Players.LocalPlayer.Character.HumanoidRootPart.Position - Raycast.Instance.Position).Magnitude <= Range then
			--- Your script
			print("A")
			
		end
		
	end
	
end)

I would basically just put this in whatever script my current code is in and put all the original code in the — Your script line correct

game.StarterGui.ScreenGui.Frame.tappleCounter.Text = tCounter

:eyes::-1:

ignore that that was from like half a year ago :sob::sob:
i tried to fix it earlier but it just wont lol