Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Gives me a underline red, something wrong here ?

Asked by 9 years ago

game.Players.ChildAdded:connect(onPlayerEntered)

2 answers

Log in to vote
0
Answered by 9 years ago

That depends on what the red underline is saying when you mouse over it.

0
Gives me red underline on ChildAdded and (onPlayerEntered) Jazzycoolivan15 0 — 9y
0
But if you mouse over it, what does it say? dekkonot 2 — 9y
0
Here what it says for me: 01:17:23.066 - Workspace.BountyScript:133: 'end' expected (to close 'function' at line 88) near '<eof>' Attempting to save score for Player 01:17:47.351 - Data for player not yet loaded, wait for DataReady 01:17:47.352 - Script 'Workspace.SaveScript', Line 2 - global saveScore 01:17:47.353 - Script 'Workspace.SaveScript', Line 257 01:17:47.353 - Stack End Jazzycoolivan15 0 — 9y
1
Judging by the message, I'd say it's wise to post your whole script so we can find the problem. IcyArticunoX 355 — 9y
View all comments (2 more)
1
"'end' expected near '<eof>'" indicates that you're missing one (or more) ends at the end of the given function @Jazzy. DataStore 530 — 9y
0
^ thanks! Jazzycoolivan15 0 — 9y
Ad
Log in to vote
0
Answered by
Marios2 360 Moderation Voter
9 years ago

You must use PlayerAdded instead of ChildAdded when you want to get the player that joined in the Players service.. Try this instead:

game.Players.PlayerAdded:connect(function(player)
-- whatever script you want to execute when someone joins
end)

No stock function or void named onPlayerEntered exists. When using PlayerAdded, the function's parenthesis refers to the player.

So, above i wrote function(player). This means that, the specific player that arrived will be referred to as player. For instance, if a player called "CookieCrumbles" enters the server, player shown above refers to game.Players.CookieCrumbles.

Remember, events can be used at multiple targets at once, so if you want to make a multiplayer game, the event's function will execute for each player inside, and towards that player.

Answer this question