Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

player.backpack code doesn't work?

Hey,

I got an code. Why that code doesn't work?

local Player = game.Players.LocalPlayer
local item = "Jeff"
local gotit = Player.Backpack:FindFirstChild(item) or Player.Character:FindFirstChild(item)
if gotit == nil then
	print("Has the Item!")
else
	print("He doesn't have Item!")
end

6 comments

1

Do you have a variable like "local player = game.Players.LocalPlayer" in your script?

0

Please post all the code that is relevant. From what you posted, we can't know if you defined the variable player and if you ended the if statement or not.

0

I

0

You've just edited your code to be completely different. Decide on what one you want then explain why it doesn't work.... Just posting a bit of code saying "It doesn't work, why" is not at all helpful.

0

Yeah, I just made something like that. Though it works, but it didn't. Could you help me please?

0

That makes even less sense than the question you originally posted... It either works or it doesn't. Also, stop changing the code. Pick one you want people to help you with, don't go off experimenting then update your question when that code also does not work. And finally, don't just post code and say "It doesn't work, why".... Are there any outputs, what is / isn't it doing?

1 answer

local Player = game.Players.LocalPlayer
local item = "Jeff"

if (Player.Backpack:FindFirstChild(item) or Player.Character:FindFirstChild(item)) then
	print("Has the Item!")
else
	print("He doesn't have Item!")
end

This discussion is preserved as it was. New answers, comments, and votes are closed.