Click to Collect

ServerScriptService

local part = game.Workspace.Part

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")

local function newPart(player)
  if player then
      local newTool = Instance.new('Tool')
      newTool.Name = 'Item'
      local handle = part:Clone()
      handle.Name = 'Handle'
      handle.Parent = newTool
      newTool.Parent = player.Backpack
 end
 
end

remoteEvent.OnServerEvent:Connect(newPart)

LocalScript

local part = game.Workspace.Part
local button = script.Parent
local canCollect = true

local ReplicatedStorage = game:GetService("ReplicatedStorage")
 
local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")

button.BackgroundTransparency = 0.90

local player = game.Players.LocalPlayer

local center = part.Position 
local radius = 5

while wait() do
    if (center-player.Character.HumanoidRootPart.Position).magnitude <= radius then
        button.BackgroundTransparency = 0
        canCollect = true
        button.MouseButton1Click:Connect(function()
            if canCollect then
                canCollect = false
                remoteEvent:FireServer(player)
                wait(3)
                canCollect = true
            end
        end)
    else
        button.BackgroundTransparency = 0.90
        canCollect = false
    end
end