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

Backpack full gui script wont come up, please help?

Asked by 3 years ago

Im making a simulator and when i fill up my backpack the gui comes but if i fill it a second time it dont pls help

the code is

local amm = script.Parent.Ammount
local max = script.Parent.Max


while true do 
    if amm.Value >= max.Value then
        game.Workspace.Values.Bool.Value = true

    end 
    script.Parent.Text = "" .. script.Parent.Ammount.Value .. " / " .. script.Parent.Max.Value
    wait(0.05)
end

the two variables are int max = 10 ammount = 1

and the script is inside a text label

1 answer

Log in to vote
1
Answered by 3 years ago
local amm = script.Parent.Ammount
local max = script.Parent.Max

amm:GetPropertyChangedSignal("Value"):Connect(function()
    if amm.Value >= max.Value then
            workspace.Values.Bool.Value = true
     end 
    script.Parent.Text = "" .. amm.Value .. " / " .. max.Value
end)

getpropertychangedsignal only fires when the specified property in the parenthesis is changed so it is better optimized than a while true do loop

0
no cjkizzy286 40 — 3y
0
it dont work but i think the problem is the frame not becoming visible cjkizzy286 40 — 3y
0
im using another script to check if its true then making a frame visible cjkizzy286 40 — 3y
Ad

Answer this question