Skriptten
|
  |
| Joined: 27 Sep 2010 |
| Total Posts: 244 |
|
|
| 12 Jun 2015 10:08 PM |
Making an RP game, the scripting won't open and the GetChildren() command only listed 1 item. The thing is, this kind of means that nothing will work and the script isn't able to access anything else in the game.
Btw, this is a GUI (I've tried to put this into a local script, it just makes errors in local instead)
t1 = script.Parent.Parent.Parent.AccessoriesTab t2 = script.Parent.Parent.Parent.AccessoriesTab2 player = game.Players.LocalPlayer mouse = player:GetMouse() opening = false open = false transition = false script.Open.Value = false w = 0 script.Parent.MouseButton1Down:connect (function (accessdown) if transition == false then if open == false then script.Open.Value = true transition = true if opening == false then opening = true if w < 1 then repeat print(w) wait() w = w + .05 t1.Position = UDim2.new(0.125, 0, -1.05+w, 0) t2.Position = UDim2.new(0.625, 0, -1.05+w, 0) until w > 1.1 or opening == false opening = false open = true t1.Active = true t2.Active = true transition = false end end else transition = true open = false t1.Active = false t2.Active = false if w > 0 then repeat print(w) wait() w = w - .05 t1.Position = UDim2.new(0.125, 0, -1.05+w, 0) t2.Position = UDim2.new(0.625, 0, -1.05+w, 0) until w < -0.1 or opening == true end transition = false script.Open.Value = false end end end)
Btw, I tested another script and it says there's only 1 item in the GUI, itself. |
|
|
| Report Abuse |
|
|
Skriptten
|
  |
| Joined: 27 Sep 2010 |
| Total Posts: 244 |
|
|
| 12 Jun 2015 10:30 PM |
| This is inside StarterGUI btw, works inside Roblox Studio but not in the game. |
|
|
| Report Abuse |
|
|
Skriptten
|
  |
| Joined: 27 Sep 2010 |
| Total Posts: 244 |
|
|
| 12 Jun 2015 11:59 PM |
Any help? Anything I don't know that could help? |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 13 Jun 2015 12:19 AM |
| It must be in a local script if you want to edit the gui. If it errors, post the errors |
|
|
| Report Abuse |
|
|
Skriptten
|
  |
| Joined: 27 Sep 2010 |
| Total Posts: 244 |
|
|
| 13 Jun 2015 12:42 AM |
The thing is, it works perfectly in studio, outside of studio it bugs. Errors found related to the glitch.
No errors in Studio, it does say "AccessoriesTab is not a valid member of ScreenGui" Normally I would think that I accidentally put 1 .Parent too many, I experimented for a while and realized that the GetChildren() function says that only itself is there.
Example
derp = script.Parent.Parent.Parent:GetChildren() wait(10) for x = 1,#derp do print (derp[x]) wait() if #derp == 1 then print'Oh dear, this will be a long day' end end
^That's the script I used to experiment, apparently it doesn't think that all the other Guis exist :/ (It's a local script) |
|
|
| Report Abuse |
|
|
|
| 13 Jun 2015 12:44 AM |
| It works fine in studio/play solo mode because server scripts run on the client. That's why calling game.Players.LocalPlayer in a server script inside solo mode works. |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 13 Jun 2015 12:45 AM |
use
for i,v in pairs(thing:GetChildren()) do
remember to use WaitForChild("thing")
to wait for objects to load. Guis can be tricky so this is essential
|
|
|
| Report Abuse |
|
|
Skriptten
|
  |
| Joined: 27 Sep 2010 |
| Total Posts: 244 |
|
|
| 13 Jun 2015 12:49 AM |
Long, then why doesn't the 2nd script work? .-. It also seems to believe that it's also the only one in the crowded room. |
|
|
| Report Abuse |
|
|
pa00
|
  |
| Joined: 06 Jun 2010 |
| Total Posts: 451 |
|
|
| 13 Jun 2015 01:04 AM |
You will have to put it in a local script, and you will also have to wait for those objects to load.
Before you can do this: t1 = script.Parent.Parent.Parent.AccessoriesTab t2 = script.Parent.Parent.Parent.AccessoriesTab2
You must do this:
script.Parent.Parent.Parent:WaitForChild("AccessoriesTab") script.Parent.Parent.Parent:WaitForChild("AccessoriesTab2) |
|
|
| Report Abuse |
|
|
Skriptten
|
  |
| Joined: 27 Sep 2010 |
| Total Posts: 244 |
|
|
| 13 Jun 2015 01:05 AM |
@TimeTicks Thanks! :D All it needed was a loading time apparently, Lol For a while I thought I needed to re-write everything. |
|
|
| Report Abuse |
|
|
Skriptten
|
  |
| Joined: 27 Sep 2010 |
| Total Posts: 244 |
|
|
| 13 Jun 2015 01:06 AM |
@pa00 Thanks, it's already fixed though. |
|
|
| Report Abuse |
|
|
|
| 13 Jun 2015 01:09 AM |
sorry, was short on time so I didn't relaly look through your scripts, just assumed that's why (typical mistake made by many)
glad you got it fixed! |
|
|
| Report Abuse |
|
|