local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local PickupItem = ReplicatedStorage:WaitForChild("PickupItem")
local PickupTweenInfo = TweenInfo.new(
.3,
Enum.EasingStyle.Linear,
Enum.EasingDirection.In,
0,
false,
0
)
local MaxPickUpDistance = 30
PickupItem.OnServerEvent:Connect(function(player, item)
local char = player.Character
local Inventory = player.Inventory
local itemValue = Inventory:FindFirstChild(item.Name)
if itemValue then
itemValue.Value = itemValue.Value + 1
local finishingLocation = char.HumanoidRootPart.CFrame
item.CanCollide = false
item.Anchored = true
local tween = TweenService:Create(item,PickupTweenInfo, {Transparency = 1, Size = Vector3.new(0,0,0), CFrame = finishingLocation})
tween:Play()
end
end)
>
The local script that fire the remote event local UIS = game:GetService("UserInputService") local pickupKey = "F" local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = game.Players.LocalPlayer local mouse = player:GetMouse()
local PlayerGui = player:WaitForChild("PlayerGui") local PickupInfoGui = PlayerGui:WaitForChild("PickupInfoGui") local PickupItem = ReplicatedStorage:WaitForChild("PickupItem")
UIS.InputChanged:Connect(function(input) if mouse.Target then if mouse.Target:FindFirstChild("Pickable") then local item = mouse.Target PickupInfoGui.Adornee = item PickupInfoGui.ObjectName.Text = item.Name PickupInfoGui.Enabled = true else PickupInfoGui.Adornee = nil PickupInfoGui.Enabled = false end end end)
UIS.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode[pickupKey] then
if mouse.Target then
if mouse.Target:FindFirstChild("Pickable") then
local item = mouse.Target
if item then
local DistanceFromItem = player:DistanceFromCharacter(item.Position)
if DistanceFromItem < 30 then
PickupItem:FireServer()
end
end
end
end
end
end)
This local script works perfectly

9 comments
I think 'item' is the name. You don't need item.Name
"item" would need to be defined for you to get it via name, but if you already have it defined why are you using Inventory:FindFirstChild(item.Name) when you could do itemValue = item.Name? Also, try printing item to see what it returns and mess around with where item is being sent from until print actually returns the instance.
Can you give the code that fires PickupItem? When it says "Attempt to index nil with 'Name'" it means that the variable item, the thing you are trying to access the property "Name" is nil. Perhaps you're not passing the variable correctly on the other script?
" item" is the workspace item
that i pick up, so i put name that can be "Log", etc
file:///C:/Users/Usuario/Pictures/Screenshots/Captura%20de%20pantalla%20(128).png
i put an image to specified
You forgot to pass the item first: PickupItem:FireServer(item)
Thanks the last answers works, thanks.