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

Help me with this tool script please?

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

✓ Accepted answer

... 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)

7 comments

0

I dont want a print

0

This script is inside a text label. So if the backpack is empty, i want the textlabel to say its empty or full.

0

Ya ik go modify it so it does whategver you want. I'm not making the entire thing for you k

0

Its in a LocalScript right

0

Oh. You mean the script below?

0

ya

0

oh, never thought of that. thanks!

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)

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