xxxxxxxxxx
function myFunction() -- Start with 'function', give it a name
-- Do something amazing
end -- Finish with 'end'
myFunction() -- Call the function later in the code
xxxxxxxxxx
--// Basic Function
function PrintingText()
print("My text here")
end
PrintingText()
xxxxxxxxxx
function MyFunction()
print('Function fired')
end)
if true == true then
MyFunction() --firing the function.
end
xxxxxxxxxx
-- You can do either
local hello = "Hello World!"
-- Or
print("whatever you want to put in the output")
xxxxxxxxxx
-- roblox luau:
_G.getPlayer = function()
print(game.Players.LocalPlayer)
end
_G.getPlayer()
-- <username>