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
|
  |
| 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
|
  |
| Joined: 15 Jan 2010 |
| Total Posts: 451 |
|
| |
|
Stiiky
|
  |
| Joined: 15 Jan 2010 |
| Total Posts: 451 |
|
| |
|
|
| 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
|
  |
| Joined: 20 Mar 2011 |
| Total Posts: 235 |
|
|
| 21 Oct 2016 05:58 PM |
| local mainFrame = player.PlayerGui:WaitForChild("StatGui"):WaitForChild("StatusFrame") |
|
|
| Report Abuse |
|
|
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 |
|
|