Im trying to store the name of a part in a string variable. but I keep getting this error: Players.Paczki_TCBC.PlayerScripts.LocalScript:35: invalid argument #3 (string expected, got Instance)
here's the part of my script that is broke:
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 < 7 then
-- we fill this in loadstring
print("poopy")
game.ReplicatedStorage.Items.Value = item -- THIS IS THE TROUBLSOME LINE
PickupItem:FireServer(item)
end
end
end
end
end
end)

4 comments
change item at line 11 to item.Name. item is an instance, item.Name is the instances name, which is a string.
the error says it all, game.ReplicatedStorage.Items.Value is a string value. item is an instance, so it gave you that error
the value expected a string (which in this case is the item's name), but the value got an instance (the item itself).
oh my gosh, how did i miss that? thank you so much!