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

Would this work?

game.Players.PlayerAdded:connect(function()

	function Leaderstats()
		
	end

	function PowerLevel()
	
	end

	function Attack()
	
	end

	function Defense()
	
	end

	function Agility()
	
	end

	function Rank()
	
	end
	
	Leaderstats()
	PowerLevel()
	Attack()
	Defense()
	Agility()
	Rank()	
	
end)

1 answer

✓ Accepted answer

Yes, this would work. It's usually considered bad practice to define functions inside other functions, because it can lead to confusing results & poor performance -- but it's okay to do.

It can also be considered useful since it hides the functions from other contexts.

A warning: Defining functions is very slow. While it's not a problem for something like PlayerAdded, since it will happen at most a few times a minute, if it's something happening a lot -- it's better to reformat to avoid that.


A PlayerAdded even without the parameter isn't very useful, don't forget it

1 comment

0

Oh yeah I forgot the player inside (), Thanks!

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