Best way to get someones backpack in Script (not local)

So I’m trying to make a simple script where you get your item in and out of replicatedstorage by standing on a part and I was wondering what is the best way to find players backpack

Use CharacterAdded connection under PlayerAdded since backpack refreshes everytime player respawns.
Or you can just

.Touched:Connect(function(Part)
    local Player = game:GetService("Players"):GetPlayerFromCharacter(Part.Parent)
    if Player ~= nil then
       Player.Backpack
    end
end)
1 Like

Oh btw what does the (Part) do in the parentheses

It’s the part touching the part.

First and foremost know that your question, has many answers because of the multiple ways to achive this.
Second read this:

In the example they show you how to access it and under methods you can choose how to access it.

game.Players.PlayerAdded:Connect(function(Player)
	local ToolData = SaveToolData:GetAsync(Player.UserId)
	
	local Backpack = Player:WaitForChild("Backpack")
	local StarterGear = Player:WaitForChild("StarterGear")

Now remember, saving them is a whole different world. I recommend watching a youtube video on it as you have to learn how to save tables to a datastore and access it. Which is harder than leaderstats lol.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.