#Weird Code

1 messages · Page 1 of 1 (latest)

hot mist
#
game.Players.PlayerAdded:Connect(function(player)
    print("a new player has joined the game")
    print(player)
end)
game.Players.PlayerAdded:Connect(function(player)
    print("a new player has joined the game"..player)
end)
``` Is this not the same exact code why am I getting an error on one and the other is perfectly fine??????
molten spruce
#

this will give the name of the player object in the form of a string, which you will be able to concatenate

#

lmk if im wrong, but showing the error message would help me in being more exact

hot mist
#

It works 😄

#

In events how do the parameters work? Are the first arguments in the function linked to the event?

molten spruce
#

pretty much, every event will give a different parameter depending on what the event is/does, like in your case .PlayerAdded gives the player that joined as a parmeter, you can check the documentation on the event to see what parameters it gives automatically

#

keep in mind that some events might not give any parameters as well

hot mist
#

Alright man thanks so much

#

You saved me XD

molten spruce
#

np

hot mist
molten spruce
#

like if you saw something you didnt understand and you want to learn more about real quick

#

but tutorials will kinda teach you the basics better

#

but doing more advanced stuff will rely on your ability to apply the things you learned to many different contexts and doing your own experimenting