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

Why is my "Full Backpack Pop-UP" not showing up when backpack is full?

Asked by 5 years ago
Edited 5 years ago

Like any other simulator, I have a backpack and I was making a pop-up GUI that shows when your backpack is full.. and I made this script and it showed no errors, so can someone help please? Also, each backpack value is ran off of one value..

here is the pop-up script..

game.Players.PlayerAdded:Connect(function(plr)
 local cr = plr.leaderstats.Coins -- leaderstat 
cr.Changed:Connect(function() 
if cr.Value == plr:FindFirstChild("BackpackEquipped").bp.Value then -- bp is the name of the value
game.StarterGui.ScreenGui1.sc1.Visible = true 
end
end)
end)

2 answers

Log in to vote
0
Answered by 5 years ago

Right here you need to make the value equal another value. It is currently returning it as ~=

if cr.Value == plr:FindFirstChild("BackpackEquipped").bp then

should be

if cr.Value == plr:FindFirstChild("BackpackEquipped").bp.Value then
0
It still doesn't show up ChefDevRBLX 90 — 5y
0
Have you tried using WaitForChild on the leaderstats and Coins? ReallyUnikatni 68 — 5y
0
Yep, but I figured it out, I simply forgot StarterGui is not a valid child of player it would be PlayerGui and It worked. ChefDevRBLX 90 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

I forgot StarterGui is not a child of player... it would be PlayerGui since I am getting the child from the player..

so instead of starterGui use,

game.Players.PlayerAdded:Connect(function(plr)
    wait(1)
    local cr = plr.leaderstats.Coins
    cr.Changed:Connect(function()
        if cr.Value == plr:WaitForChild("BackpackEquipped").bp.Value then
            if plr.PlayerGui.ScreenGui1.sc1.Visible == false then
                 plr.PlayerGui.ScreenGui1.sc1.Visible = true

            end
            end
    end)
end)

Answer this question