|
| 06 Jul 2012 09:33 AM |
I have several questions :S
1. - I want to make a GUI in my game that directs you to customize guns and everything, but first I want a GUI to appear with a loading bar and to make the player wait a bit. I added a frame that will be the StarterGui frame that pops up when you join, but how would I make it start loading as soon as you enter? 2. - How would I make the loading bar move? I heard about TweenSize, but how do I use it? 3. - How would I make a TextLabel below the bar change the number percentage based on the size of the loading bar (which represents loaded stuff)? 4. - How would I make the GUI disappear when the bar has finished loading and then another GUI appear? 5. - How would I make a TextLabel below the TextLabel which says percentage complete say what it is currently loading and change based on the size of the bar?
Sorry for having a million questions, I'm stuck on this.
-GD987, the FPS Developer- |
|
|
| Report Abuse |
|
|
Biostream
|
  |
| Joined: 28 Mar 2011 |
| Total Posts: 913 |
|
|
| 06 Jul 2012 09:38 AM |
1. - Use game.Players.ChildAdded event
2. - There's a wiki article on TweenSize. I don't use it, so I can't help you there. You could just increase the size and move over the position accordingly so it's always on the left.
3. - script.Parent.Text = tostring(loadingBar.Size.X / totalSize)
4. - In the loading script, run a check to see if the size is equal to the totalSize and if it is, do your special things. This applies to 5 also. |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2012 09:39 AM |
Thanks, can you give me any extra information on how to use ChildAdded? I've never seen much use for it before.
-GD987, the FPS Developer- |
|
|
| Report Abuse |
|
|
Biostream
|
  |
| Joined: 28 Mar 2011 |
| Total Posts: 913 |
|
|
| 06 Jul 2012 09:45 AM |
Sure. Whenever a child is added to a particular object, the .ChildAdded event fires. I mainly use it in Players, just because I have no other reason to use it anywhere else, but it is possible.
game.Workspace.ChildAdded:connect(function(c) --c is the child that was added print("Added") end)
And you can add the child for testing purposes in a different script.
wait(2)
local part = Instance.new("Part", Workspace)
>>Added |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2012 09:50 AM |
This is basically what I have so far in my loading script:
local player = game.Players.LocalPlayer game.Workspace.ChildAdded:connect(function(c) player.PlayerGui.WelcomeGui.LoadingFrame.LoadingOutline.LoadingBar:TweenSize(UDim2.new(0.996999979,0,0,0.899999976),"Out","Quart",1,true) end)
What else do I need to add? Sorry if this is a bit much >.<
-GD987, the FPS Developer- |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2012 10:08 AM |
Bump.
-GD987, the FPS Developer- |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2012 10:15 AM |
In reply to my 3rd question, how would I use what you suggested?
-GD987, the FPS Developer- |
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Jul 2012 10:27 AM |
^
You didn't even read the post. Get out if you aren't going to help in a legitimate way.
-GD987, the FPS Developer- |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2012 11:08 AM |
Da bump.
-GD987, the FPS Developer- |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2012 11:11 AM |
miz, y u no answer?!
-GD987, the FPS Developer- |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2012 11:15 AM |
No one replies to my threads qq
-GD987, the FPS Developer- |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2012 11:15 AM |
| You need to Remove the Frame. |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2012 11:17 AM |
Actually, I fixed that problem. I added a button that pops up when the bar finished loading, but now I have a new problem:
The bar loads too quick. I join and it appears as full already.
Also, I'd like it to "load" a couple of things, so once it reaches the end it goes back to start. Also, I still need help with the percentage text and the "loading this" text.
-GD987, the FPS Developer- |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2012 11:22 AM |
._.
Nobody ever helps...
-GD987, the FPS Developer- |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2012 11:34 AM |
| For the loading bar moving, if you're moving across only 1 axis but keeping the size on the other, you're better off using a for loop rather than a buggy method like TweenSize. |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2012 11:35 AM |
Wow. So how exactly would I change this?:
local player = game.Players.LocalPlayer game.Workspace.ChildAdded:connect(function(c) player.PlayerGui.WelcomeGui.LoadingFrame.LoadingOutline.LoadingBar:TweenSize(UDim2.new(0.996999979,0,0.899999976,0),"Out","Quart",1,true) player.PlayerGui.WelcomeGui.LoadingFrame.BackButton.Visible = true end)
-GD987, the FPS Developer- |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2012 11:37 AM |
For the percentage, just make the text "Bar.AbsoulteSize.X / HowBigTheBarShouldGet * 100"
And could you elaborate on the "loading things" part? |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2012 11:39 AM |
local player = game.Players.LocalPlayer game.Workspace.ChildAdded:connect(function(c) for i = 0, 1, 0.01 do play.PlayerGui.WelcomeGui.LoadingFrame.LoadingOutline.LoadingBar.Size = UDim2.new(i, 0, .9) player.PlayerGui.WelcomeGui.LoadingFrame.BackButton.Visible = true end end) |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2012 11:41 AM |
Basically it's not technically loading anything via script. It's letting the computer load the game, and the parts and everything, so there's less lag. But it is slightly only for eye candy =P Anyway, I want it to first make the bar go all the way to the end, while the text below it says "loading GUIs", then the bar resets to the first point and loads again, this time the text says "Loading Bricks" or whatever, and there's a percentage text too, that changes based on the size of the bar.
So how would I add the text thing? I would change the text off the TextLabel in the script to "Bar.AbsoulteSize.X / HowBigTheBarShouldGet * 100"? Sorry, I just don't quite understand.
-GD987, the FPS Developer- |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 06 Jul 2012 11:42 AM |
I had something like this happen to me. It's because the Player arrives before the Character, and the GUIs havent loaded for you until your character arrives so it finishes before you get there. The way i got around it was to check if the Character was ~= nil then activating it
local player = game.Players.LocalPlayer game.Workspace.ChildAdded:connect(function(c) if script.(i dont know your hierarchy).Player.Character ~= nil then player.PlayerGui.WelcomeGui.LoadingFrame.LoadingOutline.LoadingBar:TweenSize(UDim2.new(0.996999979,0,0.899999976,0),"Out","Quart",1,true) player.PlayerGui.WelcomeGui.LoadingFrame.BackButton.Visible = true else return end end) |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 06 Jul 2012 11:43 AM |
| Sorry, late post, I don't know if you fixed it yet |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2012 11:43 AM |
local player = game.Players.LocalPlayer game.Workspace.ChildAdded:connect(function(c) for i = 0, 1, 0.01 do play.PlayerGui.WelcomeGui.LoadingFrame.LoadingOutline.LoadingBar.Size = UDim2.new(i, 0, .9) player.PlayerGui.WelcomeGui.LoadingFrame.BackButton.Visible = true --Not sure what BackButton is, just leaving this line here. GetTheLabelHere.Text = i * 100.."%" Wait() end end) |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2012 11:48 AM |
Didn't work. Output:
Players.Player.PlayerGui.WelcomeGui.LoadingFrame.LoadingOutline.LoadingBar.Load:6: malformed number near '100..' 12:46:29 - Players.Player.PlayerGui.WelcomeGui.LoadingFrame.LoadingOutline.LoadingBar.Load:6: malformed number near '100..'
Script:
local player = game.Players.LocalPlayer game.Workspace.ChildAdded:connect(function(c) for i = 0, 1, 0.01 do play.PlayerGui.WelcomeGui.LoadingFrame.LoadingOutline.LoadingBar.Size = UDim2.new(i, 0, .9) player.PlayerGui.WelcomeGui.LoadingFrame.BackButton.Visible = true player.PlayerGui.WelcomeGui.LoadingFrame.LoadingPercentage.Text = i * 100.."%" Wait() end end)
-GD987, the FPS Developer- |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2012 11:50 AM |
| Oops, my bad. Put a space between the 0 and the . |
|
|
| Report Abuse |
|
|