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

Help me with this tool script please?

Asked by 10 years ago

So I tried to make a script that says if you have no gear in your inventory, the textlabel would say "You have no gear" But it doesn't work. Here is the script:

if Players.StarterPack.empty then
    wait(1)
    TextLabel.Text= "No gear in your inventory!"


end

And this a another script inside the text label that doesnt work.

if Players.StarterPack = "Knife" = true then
    wait(1)
    TextLabel.Text= "you have a gear!"

end

This means that if one player has the knife, it says you have the knife. Can you help me?

Oh, and only one person gets the knife.

2 answers

Log in to vote
0
Answered by
wazap 100
10 years ago

... We have some serious scripting issues here....

local player = game.Players.LocalPlayer
repeat wait() until player:findFirstChild"Backpack"
local bk = player.Backpack
if #bk:GetChildren()==0 then 
    print('empty')
else
    print'not empty'
end
bk.ChildAdded:connect(function(ch)
    print'not empty'
end)
bk.ChildRemoving:connect(function(ch)
    if #bk:GetChildren()==0 then
        print('empty')
    end
end)
0
I dont want a print PyccknnXakep 1225 — 10y
0
This script is inside a text label. So if the backpack is empty, i want the textlabel to say its empty or full. PyccknnXakep 1225 — 10y
0
Ya ik go modify it so it does whategver you want. I'm not making the entire thing for you k wazap 100 — 10y
0
Its in a LocalScript right wazap 100 — 10y
View all comments (3 more)
0
Oh. You mean the script below? PyccknnXakep 1225 — 10y
0
ya wazap 100 — 10y
0
oh, never thought of that. thanks! PyccknnXakep 1225 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

I changed it but it still doesnt work.

local player = game.Players.LocalPlayer
repeat wait() until player:findFirstChild"Backpack"
local bk = player.Backpack
if #bk:GetChildren()==0 then 
    script.Parent.Text = "You are a stranger!"
else
    script.Parent.Text = "You are the murderer!"
end
bk.ChildAdded:connect(function(ch)
    script.Parent.Text = "You are the murderer!"
end)
bk.ChildRemoving:connect(function(ch)
    if #bk:GetChildren()==0 then
        script.Parent.Text = "You are a stranger!"
    end
end)

Answer this question