What am I trying to do?: I am trying to make a script where when the Tomato Collides with the CuttingField and it gives the local player a cut tomato.
**What have I tried?:**I have tried many things. I have learned that using a local script doesn't work but I do not know how to get the local player without a local script. Every time I cloned it from a local script it broke the Item and it would not drop.
**More Info:**The cut tomato tool is in the ReplicatedStorage. The cutting field works and it triggers the function. I just need to know how to clone the item from the script and then transfer it to the local player.
Current Error Message: Players.TheHideousGloom.Backpack.Tomato.Script:7: attempt to index nil with 'Backpack'
Code:
local part = script.Parent.Handle
local tool = game:GetService("ReplicatedStorage"):WaitForChild("Cut Tomato")
local player = game.Players.LocalPlayer
local function GiveTool()
local toolCl = tool:Clone()
toolCl.Parent = player.Backpack
end
function OnTouch(otherpart)
if otherpart.Name == "CuttingField" and script.Parent.Name == "Tomato" then
GiveTool()
end
end
part.Touched:Connect(OnTouch)
If you need anymore info I can give it to you. Thanks in advance.

5 comments
Also that error means it doesnt know what is this backpack thing as it doesnt exist
Thanks for your reply, however, I got this error message: Players.TheHideousGloom.Backpack.Tomato.Script:6: attempt to index nil with 'WaitForChild'
oh heh i made a simple mistake lemme fix it real quick
Made a few adjustments and it worked. Thank you so much for your help!
it wasnt finding the player then i realised i was just giving it the tool for the :GetPlayerFromCharacter() so i made it script.Parent.Parent not script.Parent