Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Script not works?

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

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

4 comments

0

Thanks it works perfectly :)

0

No problem. Glad I could help!

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.

0

Then how do i make it change color i can't get that to work ??

This discussion is preserved as it was. New answers, comments, and votes are closed.