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

What would onCharacterAdded(character, player) do inside this function?

Asked by
Cub0p 0
3 years ago

So I'm following a roblox tutorial on the dev wiki and they do


local function onCharacterAdded(character, player) end player.CharacterAdded:Connect(function(character) onCharacterAdded(character, player) end)

The part I don't understand is what is the purpose of onCharacterAdded(character, player) when its already in the first function?

2 answers

Log in to vote
0
Answered by
2_MMZ 1059 Moderation Voter
3 years ago

This script will run when the player joins the game, hence the name onCharacterAdded.

Ad
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

what the script does is, whenever it detects a CHARACTER added into workspace, it runs the character added function. the CHARACTER parameter is the character of the player.

if u remove the last 3 lines nothing will even run because onCharacterAdded() is a function, and functions need to be called to be able to run. so by saying player.CharacterAdded:Connect(function()) end CALLS the onCharacterAdded() function

EDIT: j

Answer this question