I’m currently working on a prison game where when a person escapes and gets to a certain base there is a dummy where you can wear your own clothing again. Now i need that the player keeps their inventory when they do that. The current script is the following:
This script might be incorrect, so please notify me if it is!
Basically, what has gone wrong in your script is that you didn’t specify exactly which Child in player.Backpack:GetChildren() you want to move to script.Parent.BagpackRefresh. So, Studio throws an error.
local savedBackpack = script.Parent.BagpackRefresh
script.Parent.Triggered:Connect(function(player)
local cframe = player.Character.HumanoidRootPart.CFrame
local backpack = player.Backpack:GetChildren()
for i, items in pairs(backpack) do
items.Parent = savedBackpack
end
player:LoadCharacter()
wait()
player.Character.HumanoidRootPart.CFrame = cframe
for i, items in pairs(savedBackpack:GetChildren()) do
items.Parent = player.Backpack
end
end)