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)
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:
You just can’t. Try get cahracter with script.Parent.Parent
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.