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: New to FE, help with this code

Previous Thread :: Next Thread 
Fangous is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. Pxkez
Joined: 24 Sep 2015
Total Posts: 1066
11 Jun 2016 02:44 PM
Show us up to line 14
Report Abuse
Fangous is not online. Fangous
Joined: 03 Jul 2010
Total Posts: 4448
11 Jun 2016 02:44 PM
i showed u like 14 look closely
Report Abuse
Fangous is not online. Fangous
Joined: 03 Jul 2010
Total Posts: 4448
11 Jun 2016 02:45 PM
line*
Report Abuse
Fangous is not online. Fangous
Joined: 03 Jul 2010
Total Posts: 4448
11 Jun 2016 02:48 PM
soybeen halp
Report Abuse
Soybeen is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. Fangous
Joined: 03 Jul 2010
Total Posts: 4448
11 Jun 2016 03:03 PM
how did i incorrectly define it..
Report Abuse
Soybeen is not online. 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 is not online. Fangous
Joined: 03 Jul 2010
Total Posts: 4448
11 Jun 2016 03:04 PM
mine is called PlrAdded
Report Abuse
Soybeen is not online. 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 is not online. 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 is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
11 Jun 2016 03:05 PM
Awesome <3


Report Abuse
Fangous is not online. Fangous
Joined: 03 Jul 2010
Total Posts: 4448
11 Jun 2016 03:06 PM
<3
Report Abuse
Tynezz is not online. Tynezz
Joined: 28 Apr 2014
Total Posts: 4945
11 Jun 2016 03:06 PM
why not one event and multiple functions?

Report Abuse
Soybeen is not online. 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
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