So im making a little sword arena in my obby game and i scripted a brick to give you a sword and when you walk back outside the arena a door takes ur sword away. I put this script inside the door but whenever I playtest it and walk through it does not work. Can you help me?
script.Parent.Touched:Connect(function(hit)
local player = game.Players:FindFirstChild(hit.Parent)
local sword = game.Lighting:FindFirstChild("ClassicSword")
local findSword = player.Backpack:FindFirstChild("ClassicSword")
if findSword then
sword.Parent = game.Lighting
end
if not findSword then
print("Player does not have a sword in their Backpack!")
warn()
end
end)

2 comments
Yes, I recently made a thread regarding one of my items not getting out of ServerStorage to Backpack, but then I got told it had to come from ReplicatedStorage(it would replicate to all devices).
oh ok thank you!