local sword = game.ReplicatedStorage.Sword -- Variable for the sword
script.Parent.TouchEnded:Connect(function(part)--When the block is touched, this function occurs. local is = false local player = game.Players:GetPlayerFromCharacter(part.Parent)--Variable for the player for i,v in pairs(player.Backpack:GetChildren()) do if v.Name == "Sword" then is = true end end
if is == false then
if player then--If the thing that touched the object is the player then...
sword:Clone().Parent = player.Backpack--Give the sword to the player
end
end
end)

1 comment
Can you post the code correctly so we can actually read it