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

How to create message that pops up when player's backpack is full?

Asked by 4 years ago

I'm trying to script a message that appears when the player's cauldron (backpack) is full. My problem is I'm using a while loop that checks every 0.2 seconds the players inventory and updates the inventory gui to display how many potions they have (ex. 5/10).

So within this while loop I have it check if their inventory has reached the max (ex. 10/10) and if it has then make the message visible. The frame with the message lets the player either sell, upgrade, or close the message to ignore it.

My issue lies with upgrade or ignore. The condition of the cauldron being full is still met if they chose to close the frame, as well as upgrade before they actually go ahead and upgrade the potion. I'm unsure of how to make it so the script can know if the player has already seen the message.

--set lbl to current plr inv and cauldron size and update it everytime plr creates new ptn or sells

local player = game.Players.LocalPlayer

--inv lbl that displays players inv
local invLbl = player.PlayerGui:WaitForChild("InvGui"):WaitForChild("InvFrame"):WaitForChild("InvLbl")

--invfull msg frame
local invFullMsg = script.Parent.Parent.Parent:WaitForChild("InvFullFrame")

while wait(0.2) do
    --current plr inv
    local currentInv = player.leaderstats.Potions.Value
    --current cauldron size of player
    local caulSize = player.intFolder.maxPtn.Value
    --set lbl to ptns/max
    invLbl.Text = (currentInv.."/"..caulSize)

    if currentInv == caulSize then
        invFullMsg.Visible = true   
    end
end
1
possibly a debounce and have a remote fire after they sell to revert the debounce the8bitdude11 358 — 4y
0
Agreed. Use a flag that signifies that they've acknowledged the notice, and until their inventory is filled again, the notice will not show. Fifkee 2017 — 4y

Answer this question