I want to make food machines. Here is my script:
game.Workspace.Cup.clicky.MouseClick:Connect(function(player)tool:Clone().Parent = player.Character end)
It says "attempted to put nil value" and the clicky thing is the ClickDetector so when I click the cup it's supposed to give me a cup. In the Output it said "attempt to index global 'tool' (nil value)"
I also have this script:
game.Workspace.Cup.clicky.MouseClick:Connect()
And then on the Cup tool, I have a Weld script:
local prev
local parts = script.Parent:GetChildren()
for i = 1, #parts do
if ((parts[i].ClassName == "Part") or (parts[i].className == "Handle") or (parts[i].className == "WedgePart") or (parts[i].className == "WedgePart") or (parts[i].className =="Seat")or (parts[i].className == "WedgePart") or (parts[i].className == "TrussPart")or (parts[i].className == "VehicleSeat") or (parts[i].className =="UnionOperation") or (parts[i].className == "SkateboardPlatform")) then
if (prev ~= nil) then
local weld = Instance.new("Weld")
weld.Part0 = prev
weld.Part1 = parts[i]
weld.C0 = prev.CFrame:inverse()
weld.C1 = parts[i].CFra,e:inverse()
weld.Parent = prev
parts[i].Anchored = false
end
prev = parts[i]
end
end
wait(3)
Please help if you find anything wrong, or want to help. Thank you.

8 comments
We need more information. Errors? What is the thing picking up the click?
Fixed
Can you give us the exact error? Can we also get some more code, such as the tool variable.
Fixed
What is the tool variable? Trying using :WaitForChild() on it
That's the weld script I found online it's so when you grab the Cup, the player holds it right.
Can we see the actual variable in the script?
Line 10 in second script, you did 'CFra,e' not 'CFrame'.