local Item = game.ReplicatedStorage["Double Chocolate Cookie"]
script.Parent.Triggered:Connect(function(player)
print("Clicked!")
local ItemClone = Item:Clone()
ItemClone.Parent = player.Backpack
end)
Nothing seems to be wrong with this script. It works perfectly fine in a different game I have, when I check the game in server mode whilst testing, the items are still there.
What’s wrong here?
Error:
Workspace.Model.Lemon.ProximityPrompt.GiveScript:6: attempt to index nil with ‘Parent’
20:11:39.007 Stack Begin - Studio
20:11:39.007 Script 'Workspace.Model.Lemon.ProximityPrompt.GiveScript', Line 6 - Studio - GiveScript:6
20:11:39.007 Stack End - Studio```
Here’s the whole error, sorry, the first part didn’t copy:
20:17:07.813 Workspace.Model.Lemon.ProximityPrompt.GiveScript:6: attempt to index nil with 'Parent' - Server - GiveScript:6
20:17:07.813 Stack Begin - Studio
20:17:07.813 Script 'Workspace.Model.Lemon.ProximityPrompt.GiveScript', Line 6 - Studio - GiveScript:6
20:17:07.813 Stack End - Studio
Script doesn’t find tool in backpack
Similar post ^^^
Check it out : Their solution - I moved the script from StarterPlayerScripts to StarterGui and it is now working…
Also make sure the object was made in a server script because if it is on client the server won’t find it.