Alright, as the title states, I'm having issues finding the backpack of the player who clicked a block. As of now, I have this code:
script.Parent.ClickDetector.MouseClick:connect(function(hit)
script.Parent:Destroy() -- correctly destroys.
print(hit)
game.Lighting.tools.Matches:Clone().Parent = game.Players:GetPlayerFromCharacter(hit).Backpack
end)
As the comment states, the destroy works (as I'd expect), however, it won't clone into the designated location. Whenever I'm in solo mode, I get this in the output:
Workspace.Drawer.Matches.Script:4: attempt to index a nil value
If I'm actually in-game, it then displays the error at line 3 instead of 4.
This is NOT a LocalScript. game.Lighting.tools.Matchesdoes exist.
I've read that you can't reference the player through click detection, but I've even bypassed that in the conversion of a tycoon from touch to click detection buttons, letting me know it has to be possible somehow (the method I used for the tycoon didn't function here, sadly).
Thank you for reading, and I hope to find a solution to this issue!

2 comments
Oh, well, that was much more simple than expected. I forgot about the wiki in this instance, kind of ironic since I usually always look there first. Regardless though, thank you for the solution!
Anytime.