Why do i come back as Nil?

I’m attempting to get the players backpack from a tool, but i just come back as “Nil”

Code:

script.Parent.Activated:Connect(function(plr)
	local Player = game.Players:GetPlayerFromCharacter(plr)
	print(Player)
end)

Activated does not return plr which is why its nil.

You can do this instead:

1 Like

You just can’t. Try get cahracter with script.Parent.Parent

2 Likes

Activated doesn’t return a player object, which is why it returns as nil.

Assuming that the script is on the client side, you can simply access the player by using game.Players.LocalPlayer.

1 Like