Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

player.backpack code doesn't work?

Asked by 9 years ago

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
1
Do you have a variable like "local player = game.Players.LocalPlayer" in your script? InfinitivePixelsJr 542 — 9y
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. LetThereBeCode 360 — 9y
0
I Maamees13 5 — 9y
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. Uroxus 350 — 9y
View all comments (2 more)
0
Yeah, I just made something like that. Though it works, but it didn't. Could you help me please? Maamees13 5 — 9y
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? Uroxus 350 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago
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
Ad

Answer this question