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

Script not works?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

Hello I'm trying to make a loading gui but when the frame has reached (1.0, 0, 1, 0) it doesn't stop and i can't fint out how to fix it please help me here is the script

local prog = script.Parent
local gui = script.Parent.Parent.Parent.Parent.Parent
local frame = script.Parent.Parent.Parent.Parent
local lbarback = frame.LoadingBarBackground
local text = lbarback.Text
local textscript = lbarback.Text.Script

wait(0.8)
repeat
    prog.Size = prog.Size + UDim2.new(0.01, 0, 0, 0)
    wait(0.10)
until prog.Size == UDim2.new(1.0, 0, 1, 0)

while true do
    if prog.Size == UDim2.new(1.0, 0, 1, 0) then
        textscript.Disabled = true
        text.Text = "Loaded!!"
        wait(1.5)
        gui:Destroy()
    end
    wait(0.01)
end

Here is a picture Link

1 answer

Log in to vote
0
Answered by
dyler3 1510 Moderation Voter
9 years ago

Not too sure if this is the problem, but try this. I just made a few adjustments.

local prog = script.Parent
local gui = script.Parent.Parent.Parent.Parent.Parent
local frame = script.Parent.Parent.Parent.Parent
local lbarback = frame.LoadingBarBackground
local text = lbarback.Text
local textscript = lbarback.Text.Script

wait(0.8)
repeat
    X1=prog.Size.X.Scale+.01 --Adds to the scale size
    prog.Size = UDim2.new(X1, 0, 1, 0) --Applies scale
    wait(0.10)
until prog.Size.X.Scale >=1

if prog.Size.X.Scale>1 then
    prog.Size=UDim2.new(1,0,1,0) --Assures that it's not too big
end

while true do
    if prog.Size == UDim2.new(1, 0, 1, 0) then
        textscript.Disabled = true
        text.Text = "Loaded!!"
        wait(1.5)
        gui:Destroy()
    end
    wait(0.01)
end

I think that this should work. If you have any further problems, please leave a comment below. Hope I helped :P

0
Thanks it works perfectly :) casperbastholm 0 — 9y
0
No problem. Glad I could help! dyler3 1510 — 9y
1
'local' confines a variable to its specific scope. If it's defined in the global scope, as it is in this case, then all other scopes can access it because they're all under the global scope. It's also better to use local variables, even at the top of your code, for they increase efficiency and readability. Perci1 4988 — 9y
0
Then how do i make it change color i can't get that to work ?? casperbastholm 0 — 9y
Ad

Answer this question