If you use colons
Is it a method?
And the way the homepage changed
I could see the void
Is it because of how you make and modify the game?
What in the what what
I’m pretty sure using a colon just affects the self variable, and you don’t use return types in lua. Don’t quote me though, i’m not very experienced.
Functions are basically code that can be ran multiple times whenever you call upon it.
Yes, a colon notation is how you call a Method.
And a dot notation is how you can call a function.
You can read more about functions and methods on the Roblox API Documentation:
The main difference between a function and a method is that a method automatically takes self
as the first argument. self
is a value that represents the parent table which contains the method, which is a convenient reference especially when used within metatables for when you want to change any values that are contained within it. It’s also the case that all methods are essentially functions but not all functions are methods since not all functions require the use of self
to be able to operate correctly
Methods include ‘self’, whereas functions do not (by default; of course you can just add it as a parameter like I did here).
function player.Damage(self, health)
self.Humanoid:TakeDamage(health)
end
function player:Damage(health)
self.Humanoid:TakeDamage(health)
end
Then, if I wanted to say, damage all players when they joined the game
game.Players.PlayerAdded:Connect(function(Player)
Player.Damage(Player, 50)
Player:Damage(50) -- Both would work
end)