debounce = true
script.Parent.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild('Humanoid')
if humanoid ~= nil and debounce then
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.parent)
print(player.name)
hit.Position = Vector3.new(22.176, 1.5, -18.612)
local sword = game.Workspace.ClassicSword:Clone()
sword.Parent = game.Players.player.Backpack
print(sword.parent)
debounce = false
end
end)
I'm getting lost in the layers, this doesn't seem to work. I try to make a copy of the sword and then assign its parent to the player's backpack. Why doesn't this work?

2 comments
What are the outputs of your prints?
if it is a local script, you can type: sword.Parent = game.Players.LocalPlayer.Backpack