I made this script so when you touch the door it will move the passport in your inventory to replicated storage
script.Parent.Touched:Connect(function(player)
local backpack = game.Players:FindFirstChild(player.Parent.Name).Backpack
if backpack:FindFirstChild("Passport") then
print("yooo")
backpack.Passport = game.ReplicatedStorage
end
end)
and this in another doort to take it back
script.Parent.Touched:Connect(function(player)
local Passport = game.ReplicatedStorage:FindFirstChild("Passport")
local backpack = game.Players:FindFirstChild(player.Parent.Name).Backpack
if Passport then
print("yooo")
Passport = backpack
end
end)
what’s the problem?
edit: this is the error
Passport is not a valid member of Backpack "Players.ANRTNT.Backpack"
When you do the = at the end of your Passport.Parent, it will set It’s parent to the one after =., which in this case is ReplicatedStorage. It changes it’s parent.