Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
|
| 11 Jun 2016 02:35 PM |
trying to make it print ("Welcome") on the client with a PlayerAdded function on the server
Server Script: game.Players.PlayerAdded(function(player) repeat wait() until player.BackPack.ClientVerification.PlayerAdded player.BackPack.ClientVerification.PlayerAdded:FireClient() end)
Client Script: script.PlayerAdded.OnClientEvent:connect(function() print("Welcome") end)
Error: 15:34:00.473 - Workspace.ServerVerification:11: attempt to call field 'PlayerAdded' (a userdata value) 15:34:00.474 - Stack Begin 15:34:00.474 - Script 'Workspace.ServerVerification', Line 11 15:34:00.474 - Stack End |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 11 Jun 2016 02:38 PM |
game.Players.PlayerAdded:connect(function(player)
you need to connect the function :)
|
|
|
| Report Abuse |
|
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
|
| 11 Jun 2016 02:38 PM |
rookie mistake lel i got spooked when coding since this is my first time in FE |
|
|
| Report Abuse |
|
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
|
| 11 Jun 2016 02:42 PM |
New problem:
game.Players.PlayerAdded:connect(function(player) repeat wait() until player.Backpack:WaitForChild("ClientVerification") repeat wait() until player.Backpack.ClientVerification:WaitForChild("PlayerAdded") player.Backpack.ClientVerification.PlayerAdded:FireClient() --line 14 end)
Error:
15:42:19.272 - Argument 1 missing or nil 15:42:19.273 - Script 'Workspace.ServerVerification', Line 14 15:42:19.273 - Stack End |
|
|
| Report Abuse |
|
|
Pxkez
|
  |
| Joined: 24 Sep 2015 |
| Total Posts: 1066 |
|
| |
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
|
| 11 Jun 2016 02:44 PM |
| i showed u like 14 look closely |
|
|
| Report Abuse |
|
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
| |
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
| |
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 11 Jun 2016 02:50 PM |
If I were you, I would store all of the RemoteEvents in the ReplicatedStorage to keep things tidy.
Also, those repeat wait() until's are all totally unnecessary because you already have the WaitForChild()'s.
Move the PlayerAdded event to the ReplicatedStorage, and rename it to something that's not already taken (just for clarity's sake). I'm changing it to PlrAddedEvent.
game.Players.PlayerAdded:connect(function(player) game.ReplicatedStorage.PlrAddedEvent:FireClient(player) end)
|
|
|
| Report Abuse |
|
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
|
| 11 Jun 2016 02:57 PM |
| welp they now do absolutely nothing (nothing in the output) |
|
|
| Report Abuse |
|
|
Pxkez
|
  |
| Joined: 24 Sep 2015 |
| Total Posts: 1066 |
|
|
| 11 Jun 2016 02:58 PM |
game.Players.PlayerAdded:connect(function(player) wait(3) repeat wait() until player.Backpack:WaitForChild("ClientVerification") repeat wait() until player.Backpack.ClientVerification:WaitForChild("PlayerAdded") player.Backpack.ClientVerification.PlayerAdded:FireClient() --line 14 end) |
|
|
| Report Abuse |
|
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
|
| 11 Jun 2016 02:58 PM |
Server:
game.Players.PlayerAdded:connect(function(player) game.ReplicatedStorage.PlrAdded:FireClient(player) end)
Client:
game.ReplicatedStorage:WaitForChild("PlayedAdded")
game.ReplicatedStorage.PlrAdded.OnClientEvent:connect(function() print("Welcome") end) |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 11 Jun 2016 03:00 PM |
You don't need to wait for children, best to get out of that habit. Also, you incorrectly defined the event in the Server Script
Remove this line entirely game.ReplicatedStorage:WaitForChild("PlayedAdded")
|
|
|
| Report Abuse |
|
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
|
| 11 Jun 2016 03:03 PM |
| how did i incorrectly define it.. |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 11 Jun 2016 03:03 PM |
("PlayedAdded")
We changed the name of the event to PlrAddedEvent
|
|
|
| Report Abuse |
|
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
| |
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 11 Jun 2016 03:04 PM |
Okay well then keep it PlrAdded You just told it to wait for PlayerAdded which will never exist. so it will wait forever and ever and ever and ever and ever and ever and ever and ever and ever and ever and ever and ever and ever
|
|
|
| Report Abuse |
|
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
|
| 11 Jun 2016 03:05 PM |
thank u for having patience it works now |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
| |
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
| |
|
Tynezz
|
  |
| Joined: 28 Apr 2014 |
| Total Posts: 4945 |
|
|
| 11 Jun 2016 03:06 PM |
why not one event and multiple functions?
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 11 Jun 2016 03:07 PM |
@Tyn In the end, we only have 1 event and 2 listener functions. 1 in a server script, 1 in a local script
|
|
|
| Report Abuse |
|
|