#Help with updating current items holding

18 messages · Page 1 of 1 (latest)

abstract tulip
#

I want to make my current item text which is the "0/3" to update everytime I pick up an item. Right now I can only add 1 and it just stops there ;__; thanks in advance to anyone that helps!

Code:

local PartsPicked = 0

for i,v in pairs(workspace.Items:GetChildren()) do
    v.Name = "Handle"
    local trigger = Instance.new("ProximityPrompt")
    local tool = Instance.new("Tool")
    tool.Parent = workspace
    trigger.Parent = v
    trigger.Triggered:Connect(function(plr)
        local screengui = plr.PlayerGui.ScreenGui
            print(v.Name.." has been touched by "..plr.Name)
            v.Parent = tool
            tool.Parent = plr.Backpack
        screengui.Progress.Text = tostring(PartsPicked + 1).."/3"
        print(PartsPicked)
        
    end)
end```
wanton flameBOT
#

studio** You are now Level 2! **studio

dusty forum
#

add 1 to "PartsPicked"

#

then after

#

show the text

#

like

#

PartsPicked = PartsPicked + 1
screengui.Progress.Text = tostring(PartsPicked).."/3"

abstract tulip
#

thanks alot, it workedcoolguy

dusty forum
#

👍

abstract tulip
# dusty forum 👍

hey, i know this is late but what should i write if whenever i drop a tool the number of parts i pick subtracts

dusty forum
#

do you use a key on the keyboard

#

to drop your item

abstract tulip
#

yes, i use backspace

#

also the can-be-dropped option on the tools are enabled

dusty forum
#

youd have to detect when a tool gets removed from the backpack and the player

#

and write like

#

backpack.childremoved:connect(function()
--check if its in players character, if not then
PartsPicked = PartsPicked - 1
screengui.Progress.Text