Perci1
|
  |
| Joined: 24 Jan 2011 |
| Total Posts: 1027 |
|
|
| 09 Jun 2014 01:19 PM |
So when I was testing a tool I made in Start Server mode, I got this output: PlayerGui is not a valid member of Player
I was baffled by this, but then I looked in game.Players and it was correct! None of the players had a PlayerGui! I saw Backpack and StarterGear, but no PlayerGui! What in the world is going on o.o |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2014 01:30 PM |
You have to look at the player's section and then go to their PlayerGui if you are on Start Server Mode.
Ex. Start a 2 plr server What server window shows: No PlayerGui What Player1's window shows: Only Player1's PlayerGui What Player2's window shows: Only Player2's PlayerGui
But that's not the problem. The problem probably is you are messing with the Player's PlayerGui before it even loads
try using
:WaitForChild("PlayerGui")
after the player. Ex. game.Players.TheInnovative:WaitForChild("PlayerGui") |
|
|
| Report Abuse |
|
|
Perci1
|
  |
| Joined: 24 Jan 2011 |
| Total Posts: 1027 |
|
|
| 09 Jun 2014 01:53 PM |
| No, it's already loaded because I have to wait until the player's finished loading before I can use the tool. |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2014 01:54 PM |
game.Players.PlayerAdded:connect(function(p) p:WaitForChild("PlayerGui") --code here end)
Property of no one, [insert forever alone meme here] |
|
|
| Report Abuse |
|
|
Perci1
|
  |
| Joined: 24 Jan 2011 |
| Total Posts: 1027 |
|
|
| 09 Jun 2014 01:55 PM |
| Did you not read my last post? |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2014 01:57 PM |
Ys I did.
Did you not read the "hot to get help" forum?
It tells you to not post lines of code(Well done you didn't) And at the same time don't post zero lines of code and tell us to do something -.-
Property of no one, [insert forever alone meme here] |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
| |
|
Perci1
|
  |
| Joined: 24 Jan 2011 |
| Total Posts: 1027 |
|
|
| 09 Jun 2014 02:00 PM |
If you really want the code, here it is. I don't think it will make a difference.
wait(0.1) local tool = script.Parent local plr = tool.Parent.Parent local throwAnim = plr.Character.Humanoid:LoadAnimation(tool.ThrowAnim) local firing = false
function fire(mouse) local rock = Instance.new("Part") --BodyForce local bf = Instance.new("BodyForce",rock) bf.force = Vector3.new(0,220,0) --Mesh local mesh = Instance.new("SpecialMesh",rock) mesh.MeshId = "http://www.roblox.com/asset/?id=1290033" mesh.TextureId = "http://www.roblox.com/asset/?id=1290030" --Rock rock.Name = "Rock" rock.CanCollide = false rock.Size = Vector3.new(1, 1, 1) rock.Parent = workspace rock.Anchored = false rock.CFrame = CFrame.new(tool.Handle.CFrame.p,mouse.Hit.p) rock.Velocity = rock.CFrame.lookVector * 100 --Touched event rock.Touched:connect(function(hit) if hit.Parent.Name == plr.Name then return end wait(.5) rock:remove() if game.Players:GetPlayerFromCharacter(hit.Parent) then local p = game.Players:GetPlayerFromCharacter(hit.Parent) p.PlayerGui.ControlOff.Disabled = false p.Character.Humanoid.PlatformStand = true wait(1) p.PlayerGui.ControlOn.Disabled = false p.Character.Humanoid.PlatformStand = false p.PlayerGui.ControlOn.Disabled = true p.PlayerGui.ControlOff.Disabled = true end end) end
tool.Equipped:connect(function(mouse) mouse.Button1Down:connect(function() if not firing then firing = true throwAnim:Play() wait(0.3) tool.Handle.Transparency = 1 fire(mouse) wait(3) firing = false tool.Handle.Transparency = 0 end end) end) |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2014 02:07 PM |
Can you tell me what line this is I'm not going to count.
p.PlayerGui.ControlOff.Disabled = false
But anyway before that;
pGui = plr:WaitForChild("PlayerGui")
then just call it from there is what I would assume
Property of no one, [insert forever alone meme here] |
|
|
| Report Abuse |
|
|
Perci1
|
  |
| Joined: 24 Jan 2011 |
| Total Posts: 1027 |
|
|
| 09 Jun 2014 02:09 PM |
| I still don't think that's the problem, because if my tool, character, and backpack is loaded how can the player gui not be loaded? |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2014 02:13 PM |
Not everything loads at once...
Property of no one, [insert forever alone meme here] |
|
|
| Report Abuse |
|
|
Perci1
|
  |
| Joined: 24 Jan 2011 |
| Total Posts: 1027 |
|
|
| 09 Jun 2014 02:38 PM |
if game.Players:GetPlayerFromCharacter(hit.Parent) then local p = game.Players:GetPlayerFromCharacter(hit.Parent) print("waiting for player gui") p:WaitForChild("PlayerGui") print("player gui loaded") p.PlayerGui.ControlOff.Disabled = false p.Character.Humanoid.PlatformStand = true wait(1) p.PlayerGui.ControlOn.Disabled = false p.Character.Humanoid.PlatformStand = false p.PlayerGui.ControlOn.Disabled = true p.PlayerGui.ControlOff.Disabled = true end
It does print waiting for player gui, but never player gui loaded. Even after I wait like 30 seconds for it to load. |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 09 Jun 2014 02:46 PM |
Put this
print("waiting for "..p.Name.."'s PlayerGui")
And make sure that you're looking in the right place |
|
|
| Report Abuse |
|
|
Perci1
|
  |
| Joined: 24 Jan 2011 |
| Total Posts: 1027 |
|
|
| 09 Jun 2014 02:53 PM |
| What I print will not matter... |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2014 02:56 PM |
| you seem stubborn, I'm not even going to attempt to help. |
|
|
| Report Abuse |
|
|
Perci1
|
  |
| Joined: 24 Jan 2011 |
| Total Posts: 1027 |
|
|
| 09 Jun 2014 03:07 PM |
| I'm only stubborn when I know something will not make a difference. |
|
|
| Report Abuse |
|
|
| |
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 09 Jun 2014 04:12 PM |
He is very stubborn.
From the script I saw it could have been anything touching it because he didn't check to see if there was a humanoid.
Don't ask for help until you grow up. |
|
|
| Report Abuse |
|
|
Perci1
|
  |
| Joined: 24 Jan 2011 |
| Total Posts: 1027 |
|
|
| 10 Jun 2014 09:47 AM |
If you actually took the time to read it, you might have noticed
if game.Players:GetPlayerFromCharacter(hit.Parent) then
which checks if it's really a player that touched it. This is better than checking for a humanoid, because then the script would work for a NPC.
Changing the print won't make a difference, if you don't know how to help, don't try. |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 10 Jun 2014 09:50 AM |
You never know what might happen.
Very often I see things that I thought shouldn't happen.
You're going nowhere in life, my friend. |
|
|
| Report Abuse |
|
|
Perci1
|
  |
| Joined: 24 Jan 2011 |
| Total Posts: 1027 |
|
|
| 10 Jun 2014 09:55 AM |
Alright then, how could it make a difference?
"You're going nowhere in life" Wow, that's totally not an ad hominem... but I don't really think you could be the judge of my life, considering you don't know me. |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 10:08 AM |
I believe that with the new FilteringEnabled property, server scripts cannot access a player's PlayerGui with it enabled.
There are at least two ways of getting around this: #1 Setting FilteringEnabled to false, #2 Using RemoteEvents to insert the GUI into the player's PlayerGui.
For some reason I can't always get RemoteEvents to work for sending a request to a player. |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 10:10 AM |
@pro
Um, yes they can lol. Serverscripts can access playergui, however, clients cannot access the server or make any changes to it. |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 10:11 AM |
| Okay then, check for yourself. |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 10:13 AM |
| I did and am since I am creating a game with filteringenabled on. |
|
|
| Report Abuse |
|
|