generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: GUI not fading out

Previous Thread :: Next Thread 
robokittydestroyer is not online. robokittydestroyer
Joined: 20 Jul 2010
Total Posts: 311
11 Aug 2014 04:43 PM
I have a function that is supposed to make all the elements in a GUI fade out, but it doesn't do anything. The hierarchy is below. I have noticed that there is an infinite loop when it gets to the Choices frame. The function is below the hierarchy.

Hierarchy:
---------------

~MainMenu (ScreenGui)
>Sound (Sound)
>LocalScript (LocalScript) [Contains the Fade function]
>Settings (Frame)
-SettingToggle (ImageButton)
-ToolTip (TextLabel)
>Options (Frame)
-Load (TextButton)
-Party (TextButton)
+Choices (Frame)
=Create (TextButton)
=Join (TextButton)
-Start (TextButton)
>Logo (ImageLabel)


Fade Function:
----------------------

function fade(parent,dir,speed)
if dir == 1 then
for i=0,1,math.abs(speed) do
for _,obj in pairs(parent:GetChildren()) do
print("Current:",i,obj:GetFullName())

if obj.ClassName == "Frame" then
if obj.Style ~= Enum.FrameStyle.Custom then
obj.Style = Enum.FrameStyle.Custom
end
obj.BackgroundTransparency = i
elseif obj.ClassName == "ImageLabel" then
obj.ImageTransparency = i
elseif obj.ClassName == "TextButton" then
if obj.Style ~= Enum.ButtonStyle.Custom then
obj.Style = Enum.ButtonStyle.Custom
end
obj.BackgroundTransparency = i
end

if #obj:GetChildren() > 0 then
fade(obj,dir,speed)
end

if i >= 1 then obj.Visible = false end
end
wait(speed)
end
end
end
Report Abuse
Alexware is not online. Alexware
Joined: 07 May 2010
Total Posts: 661
11 Aug 2014 04:45 PM
2manywords|is mind blown


Ok so, try a while true do
obj.BackgroundTransparency=obj.BackgroundTransparency - PutSpeedHere( 0.01 = best quality, 1 = lolno. ew.)
Report Abuse
robokittydestroyer is not online. robokittydestroyer
Joined: 20 Jul 2010
Total Posts: 311
11 Aug 2014 04:51 PM
A while true loop won't work for what I'm trying to do. I want to eliminate the infinte loop.
Report Abuse
alij12 is not online. alij12
Joined: 03 Oct 2011
Total Posts: 1204
11 Aug 2014 04:51 PM
a for loop
Report Abuse
robokittydestroyer is not online. robokittydestroyer
Joined: 20 Jul 2010
Total Posts: 311
11 Aug 2014 04:55 PM
That's what I am using...

The issue is occuring at the recursive function.
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
11 Aug 2014 05:01 PM
life is a mystery
Report Abuse
awesomeplayer7000 is not online. awesomeplayer7000
Joined: 09 Apr 2014
Total Posts: 1112
11 Aug 2014 05:02 PM
you have a bad life for not helping
Report Abuse
robokittydestroyer is not online. robokittydestroyer
Joined: 20 Jul 2010
Total Posts: 311
11 Aug 2014 05:04 PM
@dueling; True, but not related to the issue.
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
11 Aug 2014 05:12 PM
@awesome

i hav a good life
Report Abuse
robokittydestroyer is not online. robokittydestroyer
Joined: 20 Jul 2010
Total Posts: 311
11 Aug 2014 05:21 PM
Let's get back on topic. Any idea on how to stop the infinite loop?
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
11 Aug 2014 05:27 PM
did you define speed
Report Abuse
robokittydestroyer is not online. robokittydestroyer
Joined: 20 Jul 2010
Total Posts: 311
11 Aug 2014 05:30 PM
'speed' is one of the arguments. When I call the function, it is set to 1/30.
Report Abuse
robokittydestroyer is not online. robokittydestroyer
Joined: 20 Jul 2010
Total Posts: 311
11 Aug 2014 06:17 PM
bump()
Report Abuse
robokittydestroyer is not online. robokittydestroyer
Joined: 20 Jul 2010
Total Posts: 311
11 Aug 2014 06:39 PM
bump2()
Report Abuse
robokittydestroyer is not online. robokittydestroyer
Joined: 20 Jul 2010
Total Posts: 311
11 Aug 2014 07:30 PM
bump3()
Report Abuse
robokittydestroyer is not online. robokittydestroyer
Joined: 20 Jul 2010
Total Posts: 311
11 Aug 2014 08:05 PM
bump
Report Abuse
robokittydestroyer is not online. robokittydestroyer
Joined: 20 Jul 2010
Total Posts: 311
11 Aug 2014 08:42 PM
I fixed the infinite loop, but only the frames are fading out. Everything else in the GUI is still visible. This is my current function:

function fade(parent,dir,speed)
if dir == 1 then
for i=0,1,math.abs(speed) do
for _,obj in pairs(parent:GetChildren()) do
print("Current:",i,obj:GetFullName())

if obj:IsA("GuiObject") then
if obj.BackgroundTransparency ~= 1 then
if obj.ClassName == "Frame" then
if obj.Style ~= Enum.FrameStyle.Custom then
obj.Style = Enum.FrameStyle.Custom
end
obj.BackgroundTransparency = i
elseif obj.ClassName == "ImageLabel" then
obj.ImageTransparency = i
elseif obj.ClassName == "ImageButton" then
obj.ImageTransparency = i
elseif obj.ClassName == "TextButton" then
if obj.Style ~= Enum.ButtonStyle.Custom then
obj.Style = Enum.ButtonStyle.Custom
end
obj.BackgroundTransparency = i
end
end
end

if i == 1 then
if #obj:GetChildren() == 0 then
print(obj.Name.." is done!")
obj.Visible = false
else
fade(obj,dir,speed)
end
end
end
wait(speed)
end
end
end
Report Abuse
robokittydestroyer is not online. robokittydestroyer
Joined: 20 Jul 2010
Total Posts: 311
11 Aug 2014 09:01 PM
bumpy
Report Abuse
Distortional is not online. Distortional
Joined: 22 Nov 2011
Total Posts: 6530
11 Aug 2014 09:30 PM
Wow... You're making that a lot more complicated than it needs to be.

If you look closely, I don't give a crap.
Report Abuse
robokittydestroyer is not online. robokittydestroyer
Joined: 20 Jul 2010
Total Posts: 311
12 Aug 2014 05:01 PM
bump
Report Abuse
robokittydestroyer is not online. robokittydestroyer
Joined: 20 Jul 2010
Total Posts: 311
12 Aug 2014 05:31 PM
b
Report Abuse
robokittydestroyer is not online. robokittydestroyer
Joined: 20 Jul 2010
Total Posts: 311
12 Aug 2014 05:59 PM
b1
Report Abuse
robokittydestroyer is not online. robokittydestroyer
Joined: 20 Jul 2010
Total Posts: 311
12 Aug 2014 07:45 PM
b2
Report Abuse
robokittydestroyer is not online. robokittydestroyer
Joined: 20 Jul 2010
Total Posts: 311
12 Aug 2014 08:11 PM
b3
Report Abuse
robokittydestroyer is not online. robokittydestroyer
Joined: 20 Jul 2010
Total Posts: 311
12 Aug 2014 08:56 PM
b4
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image