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 » Scripters
Home Search
 

Re: It's very annoying how simple this script is and still fails

Previous Thread :: Next Thread 
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
17 Jul 2015 07:46 PM
print ("Hello World!")
print (game.Players.LocalPlayer.PlayerGui:FindFirstChild ("IntroGui"))
repeat wait () until game.Players.LocalPlayer.PlayerGui:FindFirstChild ("IntroGui") == nil -- apparently not the same not game.Players.LocalPlayer.PlayerGui:FindFirstChild ("IntroGui")
print ("test")
script.Parent.Background.Visible = true

test never prints. The repeat loop goes on forever even though the second print statement is already nil

Hello World!
Report Abuse
membra is not online. membra
Joined: 14 Oct 2008
Total Posts: 6313
17 Jul 2015 07:51 PM
The :FindFirstChild() method will return true or false depending on whether or not if finds the object. It can not return nil.
Your comments gave me a headache, but I'd assume that you've tried 'not FindFirstChild' already?


[i like rhubarb]
Report Abuse
membra is not online. membra
Joined: 14 Oct 2008
Total Posts: 6313
17 Jul 2015 07:53 PM
I was wrong, I booted up Studio and gave it a go, apparently it does return nil. I'll go sit in the corner of shame now.


[i like rhubarb]
Report Abuse
iSpecializinq is not online. iSpecializinq
Joined: 31 May 2015
Total Posts: 2182
17 Jul 2015 07:54 PM
@membra
its okay, i used to give terrible advice a few years ago like

Gui.Color = BrickColor.new()

while true do with no wait()

etc, you get the point.

and the funny thing, i didnt MEAN to give it wrong, i was just that dumb.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
17 Jul 2015 07:55 PM
print(game.Workspace:FindFirstChild("derp"))
while game.Workspace:FindFirstChild("derp") == nil do
wait(1)
print'working'
end

??? This works for me ^ (what you should be doing)

print(game.Workspace:FindFirstChild("derp"))
repeat
wait(1)
print("not working")
until game.Workspace:FindFirstChild("derp") == nil

This works for me too ^



My guess is that IntroGui has not loaded in, so it prints nil, but when you use repeat it forces whatever is under repeat to run before checking, meaning you wait 0.03, allowing the IntroGui to load in and for the script to wait forever.
Report Abuse
membra is not online. membra
Joined: 14 Oct 2008
Total Posts: 6313
17 Jul 2015 08:05 PM
@iSpecializinq
I'm rolling on 2 hours of sleep and have been sitting here for the past four hours listening to Spooky Scary Skeletons and waiting for VS to reinstall. My brain it mush right now. I promise, I'm usually not quite this stupid! :P

@Maxomega3
I tried executing this statement...
repeat wait() until workspace:FindFirstChild("BasePlate") == nil
...in Studio and it does drop out of the loop once I delete the BasePlate part.
Have you checked the fundamentals, like are you actually deleting the instance that it is checking for, are you checking the correct instance?

Either that or I'm being an idiot and missing something stupidly simple.


[i like rhubarb]
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
17 Jul 2015 08:34 PM
>Either that or I'm being an idiot and missing something stupidly simple.
nop, that's probably me

you see, even if the GUI does load in, it destroys itself after a while



Hello World!
Report Abuse
Despawned is not online. Despawned
Joined: 06 Apr 2013
Total Posts: 12569
17 Jul 2015 08:58 PM
@ispec "a few years ago"

>joined in 2015
Report Abuse
iiEssence is not online. iiEssence
Joined: 18 Jun 2014
Total Posts: 3467
17 Jul 2015 09:17 PM
^ What if i told you, I have 9 different accounts


I don't need a siggy
Report Abuse
iSpecializinq is not online. iSpecializinq
Joined: 31 May 2015
Total Posts: 2182
17 Jul 2015 09:18 PM
@Despawned

So your claiming i didnt originally join in 06?

Nice open-mind ya got there.
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
17 Jul 2015 11:16 PM
...
HALP



Hello World!
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
17 Jul 2015 11:17 PM
@OP
"My guess is that IntroGui has not loaded in, so it prints nil, but when you use repeat it forces whatever is under repeat to run before checking, meaning you wait 0.03, allowing the IntroGui to load in and for the script to wait forever."

Report Abuse
EgoMoose is not online. EgoMoose
Joined: 04 Feb 2009
Total Posts: 2896
17 Jul 2015 11:19 PM
Try WaitForChild in the initial print statement and then try using not as opposed to == nil?
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
17 Jul 2015 11:25 PM
@Ego, I had that code originally. Yet again, I had a WaitForChild () beforehand that would never be there.

@thedestroyer
I've already addressed this. I said even if it did load in, at the end of its run, the GUI destroys itself



Hello World!
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
17 Jul 2015 11:27 PM
I re-added the WaitForChild and it does pass over it, but the repeat loop still remains stuck.



Hello World!
Report Abuse
EgoMoose is not online. EgoMoose
Joined: 04 Feb 2009
Total Posts: 2896
17 Jul 2015 11:28 PM
And you can confirm that in the explorer it is in fact removing itself, yes?
Report Abuse
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
17 Jul 2015 11:29 PM
this code breaks the laws of logic

ʏᴏᴜ ᴛʜᴏᴜɢʜᴛ ʏᴏᴜ ᴄᴏᴜʟᴅ ᴅʀᴀɢ ᴍᴇ ᴛᴏ ᴛʜᴇ ʙᴏᴛᴛᴏᴍ ᴏғ ᴛʜᴇ ʟᴀᴋᴇ sᴏ ʏᴏᴜ ᴄᴏᴜʟᴅ ᴇᴀᴛ ᴍᴇ ʟᴀᴛᴇʀ... ᴡᴇʟʟ ɢᴜᴇss ᴡʜᴀᴛ ᴘᴜɴᴋ... ɪᴍ ᴀ ғɪsʜ... ᴡɪᴛʜ ʟᴇɢs
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
17 Jul 2015 11:30 PM
interesting. It is, in fact, not being removed. I guess I'll have to figure that out



Hello World!
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
17 Jul 2015 11:32 PM
well that was embarrassing. There was a similar GUI with an identical name in the PlayerGui.

Sadly, after removing it, the loop still didn't break



Hello World!
Report Abuse
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
17 Jul 2015 11:39 PM
repeat wait() until game.Players.LocalPlayer
local plr = game.Players.LocalPlayer
local gui = plr.PlayerGui:FindFirstChild("IntroGui") or "This crap don't exist nub bruh"

print(gui)
repeat wait() until not plr.PlayerGui:FindFirstChild("IntroGui") == nil
print(gui) -- if this dont print then the above line never found "IntroGui"



ʏᴏᴜ ᴛʜᴏᴜɢʜᴛ ʏᴏᴜ ᴄᴏᴜʟᴅ ᴅʀᴀɢ ᴍᴇ ᴛᴏ ᴛʜᴇ ʙᴏᴛᴛᴏᴍ ᴏғ ᴛʜᴇ ʟᴀᴋᴇ sᴏ ʏᴏᴜ ᴄᴏᴜʟᴅ ᴇᴀᴛ ᴍᴇ ʟᴀᴛᴇʀ... ᴡᴇʟʟ ɢᴜᴇss ᴡʜᴀᴛ ᴘᴜɴᴋ... ɪᴍ ᴀ ғɪsʜ... ᴡɪᴛʜ ʟᴇɢs
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
17 Jul 2015 11:41 PM
Run this:

local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
print(PlayerGui:FindFirstChild ("IntroGui"))
while PlayerGui:FindFirstChild("IntroGui") == nil do
wait(1)
print(PlayerGui:FindFirstChild("IntroGui"))
end
print ("Completed")

Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
17 Jul 2015 11:53 PM
you guys realize I'm trying to wait for it to disappear, not appear, right?



Hello World!
Report Abuse
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
17 Jul 2015 11:55 PM
We need to know the how your managing IntroGui, whether your removing it completely or just turning it to 1 transparency.

ʏᴏᴜ ᴛʜᴏᴜɢʜᴛ ʏᴏᴜ ᴄᴏᴜʟᴅ ᴅʀᴀɢ ᴍᴇ ᴛᴏ ᴛʜᴇ ʙᴏᴛᴛᴏᴍ ᴏғ ᴛʜᴇ ʟᴀᴋᴇ sᴏ ʏᴏᴜ ᴄᴏᴜʟᴅ ᴇᴀᴛ ᴍᴇ ʟᴀᴛᴇʀ... ᴡᴇʟʟ ɢᴜᴇss ᴡʜᴀᴛ ᴘᴜɴᴋ... ɪᴍ ᴀ ғɪsʜ... ᴡɪᴛʜ ʟᴇɢs
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
18 Jul 2015 12:02 AM
Destroying it .-.

anyway, by some weird occurance, it works perfectly in online mode. Go figure

-case closed-



Hello World!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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