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: Cannot find child?

Previous Thread :: Next Thread 
Stiiky is not online. Stiiky
Joined: 15 Jan 2010
Total Posts: 451
21 Oct 2016 04:47 PM
My script for some reason, cannot find "StatGui" which is a valid child of PlayerGui. In Studio, the code runs fine. But in-game it doesn't work.
I've tried findfirstchild, waitforchild yet none of them work.
Heres the code:

local mainFrame = player.PlayerGui:WaitForChild("StatGui").StatusFrame
If I change it to

local mainFrame = player.PlayerGui.StatGui.StatusFrame
The player is valid, but it says it cannot find StatGui. Yet it is exactly called "StatGui" typed just like that in studio.


Report Abuse
Stiiky is not online. Stiiky
Joined: 15 Jan 2010
Total Posts: 451
21 Oct 2016 04:49 PM
Oh, and this is in a ServerScript and both WaitForChild and FindFirstChild do not work.


Report Abuse
Stiiky is not online. Stiiky
Joined: 15 Jan 2010
Total Posts: 451
21 Oct 2016 05:27 PM
bump


Report Abuse
Stiiky is not online. Stiiky
Joined: 15 Jan 2010
Total Posts: 451
21 Oct 2016 05:39 PM
bump2


Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
21 Oct 2016 05:51 PM
is there a variable for player?

also u could putthe gui into StarterGui then put:
local mainFrame = game:GetService("StarterGui").StatGui.StatusFrame
local player = game.Players.LocalPlayer

mainFrame.Parent = player.PlayerGui

for _,v in pairs(player.PlayerGui:GetChildren()) do
if v.Name == "mainFrame" and v.Parent == player.PlayerGui then
print("mainframe is in the player's playergui")
end
end
Report Abuse
fear2213 is not online. fear2213
Joined: 20 Mar 2011
Total Posts: 235
21 Oct 2016 05:58 PM
local mainFrame = player.PlayerGui:WaitForChild("StatGui"):WaitForChild("StatusFrame")
Report Abuse
Stiiky is not online. Stiiky
Joined: 15 Jan 2010
Total Posts: 451
21 Oct 2016 06:43 PM
@fear I told you, doesn't work.
@goml I'm not trying to update everyones. Everyone has seperate stats.


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