Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Gives me a underline red, something wrong here ?

game.Players.ChildAdded:connect(onPlayerEntered)

2 answers

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

6 comments

0

Gives me red underline on ChildAdded and (onPlayerEntered)

0

But if you mouse over it, what does it say?

0

Here what it says for me: 01:17:23.066 - Workspace.BountyScript:133: 'end' expected (to close 'function' at line 88) near '' 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

1

Judging by the message, I'd say it's wise to post your whole script so we can find the problem.

1

"'end' expected near ''" indicates that you're missing one (or more) ends at the end of the given function @Jazzy.

0

^ thanks!

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.