Using functions
In this section, we will start using something called functions. Let us start by finding out when to use functions. In Chapter 1, Getting Up to Speed with Roblox and Luau Basics, we saw the following code:
local MINIMUM_PLAYERS = 1 local MAXIMUM_PLAYERS = 8 local playerPosition = 1 -- Checking if the player's position is a valid number if playerPosition >= MINIMUM_PLAYERS and playerPosition <= MAXIMUM_PLAYERS then -- Getting correct message based on player›s position if playerPosition <= 3 then print("Well done! You are in spot " .. playerPosition .. "!") elseif playerPosition <= 5 then print("You are almost there!") else print("You are not in the top three yet! Keep going!") end else -- The...