I just made a "Dig" tool that, when the player clicks on certain parts, it gives him the item from ServerStorage that a Value in the part names. I've tried a StringValue to search for the item by name, and ObjectValue to link directly to the item, but both cases give me the same error saying that it's attempting to index a nil value. Here's the block in question:
function clicked()
if mouse.Target == nil then return end --mouse is defined earlier
if equip == false then return end -- T/F variable defined earlier
if mouse.Target.Name == "dgSpot" then
local tlname = mouse.Target.Tool.Value
-- Line below is for StringValue
--local tool = game.ServerStorage:FindFirstChild(tlname):Clone()
-- Line below is for ObjectValue
local tool = tlname:Clone()
tool.Parent = player.Backpack
end
end
mouse.Button1Down:connect(clicked)

2 comments
Put them in lightning. I believe it will work better that way.
lol put them in the storage place that ROBLOX is trying to depricate?