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

Why will my simple backpack detecting script not work?

Asked by 7 years ago

I ~attempted~ to create a simple script that detects if a certain tool is in the players backpack. However, the script does nothing, and gives no errors in the output. Here is the script:

if game.Players.LocalPlayer.Backpack:findFirstChild("Sword1") then
    print("Test")
end
0
Is this the whole script? AstrealDev 728 — 7y
0
Yeah GotSanity 16 — 7y
0
Because you wrote findFirstChild instead of FindFirstChild. always check your spelling if the script doesn't work Nogalo 148 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Try placing the code in a LocalScript and placeing that in the StarterPlayerScripts. It needs to be in a LocalScript to use "LocalPlayer"

0
How are you testing this? If you are testing this immediately after you start playing and you have put "Sword1" in starter gear then you need time for the gear to load in your backpack. Worthy0ne 68 — 7y
Ad

Answer this question