0% found this document useful (0 votes)
11 views3 pages

Basedmessage

The document provides a tutorial on basic Lua programming concepts, including printing text, defining functions, using tables, and handling boolean values. It also covers the usage of the RunService for game updates and the Debris service for object management in a game environment. Additionally, it illustrates control flow with conditional statements and instance creation in a game workspace.

Uploaded by

yukonsomething
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

Basedmessage

The document provides a tutorial on basic Lua programming concepts, including printing text, defining functions, using tables, and handling boolean values. It also covers the usage of the RunService for game updates and the Debris service for object management in a game environment. Additionally, it illustrates control flow with conditional statements and instance creation in a game workspace.

Uploaded by

yukonsomething
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

`-- Print out a text

print("Text goes here")

-- Print out a text with value


local valuename = 10
print("Text goes here with value: " .. valuename)

-- Function

function FunctionName(...)
print(...)
end

FunctionName("Test", "threedotsahhthing")

function FunctionName2(text, bool)


print(text)
print(bool)
end

FunctionName2("Text 12535316+", false)

-- Tables

local Table = {
"One"; -- will be indexed as 1 ( Table[1] )
["PlayerName"] = "Developer" -- will be indexed as PlayerName
( Table[PlayerName] ), but the value will be "developer"
}

table.insert(Table, "Third") -- will insert a value into a table, and it will be


indexed with [3]
table.find(Table, "Third") -- Searches for a value in the table (in this case its
"Third")

if table.find(Table, "Third") then


print("Third found")
end

-- Services
local RunService = game:GetService("RunService") -- Service that runs every
tick(used for updating something with ur fps)
--//RunService usage
RunService.RenderStepped:Connect(function(dt)
print("Current DeltaTime is: "..math.ceil(dt))
end)

-- RunService.PreRender Does the same thing as RenderStepped

-- RunService:BindToRenderStep("BindName", 200) does the same thing as renderstepp


but instead of always being enabled, its being binded, and can be unbinded from the
client
-- RunService:UnbindFromRenderStep("BindName")

--//Debris
-- Debris service is used to destroy something, for ex:
local Debris = game.Debris
Debris:AddItem(workspace.SpawnLocation, 10) -- destroys spawnlocation part after 10
seconds
--//

--// bools

local bool = false


bool = true -- sets bool to true

if bool then
print("bool is true")
else
print("bool is false")
end

bool = not bool -- sets bool to the opposite

if bool then
print("bool is true")
else
print("bool is false")
end

bool = "Text"

print(bool)

--// If, else,ifelse, ==, <=, >=, =-, =+

-- If is used if you want to check for something


--// Ex:
if workspace:FindFirstChild("Baseplate") then
print("Baseplate Exists")
else
print("Baseplate doesnt Exists")
end

--// You can also use == to check instance bools


if workspace.Baseplate.Color == Color3.new(163, 162, 165) then
print("Baseplate color is 163, 162, 165")
else
print("Baseplate color is not 163, 162, 165")
end

local bool = 6

if bool <= 5 then


print("Bool is smaller or 5")
elseif bool <= 10 then
print("Bool is smaller than 10 or equals 10")
else
print("bool is greater than 10")
end

--// Instances

local instancenew = Instance.new("Part") -- Part for example


instancenew.Parent = game .Workspace -- sets parent for the part

instancenew. CFrame = CFrame.new(0,25,0) -- Set Parts location


instancenew.Anchored = true -- anchores part

local clone = instancenew:Clone()


clone. CFrame = CFrame.new(1,25,0) -- Set Parts location`

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy