#how does roblox's mathematics work?

1 messages · Page 1 of 1 (latest)

potent wagon
#

i just dont get Luau's math

fallen raptor
dusty minnowBOT
#

studio** You are now Level 10! **studio

potent wagon
# fallen raptor how so?

idk l was reading luau get started and they use math but why cant you just put in the right number

potent wagon
#

u'll see

echo berry
potent wagon
echo berry
#

just like in normal math bro

Number1 = 1
Number2 = 2

print(Number1 + Number2) ---> prints 3 bc Number1 is set to 1 and Number2 is set to 2
1 + 2

dusty minnowBOT
#

studio** You are now Level 1! **studio

harsh glade
#

1+1=2

echo berry
mild bloom
#

why are you calling them placeholders

coarse wasp
#

💔

coarse wasp
mild bloom
#

its just so werid

mild bloom
coarse wasp
#

its just maths

#

whats so complicated

mild bloom
#

nothing

#

i dont understand whats hes saying

potent wagon
coarse wasp
#

i mean

#

you can

#

you dont need to

mild bloom
#

its just math

coarse wasp
#
print("2")
potent wagon
coarse wasp
#

for example

#

adding to leaderstats

mild bloom
coarse wasp
#

and you use math to calculate velocity

#

it was an example

#

whats so hard to understand

potent wagon
coarse wasp
mild bloom
coarse wasp
#
leaderstats.Cash.Value += 1
#

this is an example

#

just adding 1

#

what are you confused about mr samwich

potent wagon
#

i know that but people mostly use it for camera views and pov's why do they do math

mild bloom
#

like i said

#

go learn more

#

you dont have a clear understanding

#

its just like any other programming language

harsh glade
#

1+1=2
1-1=0
1*1=1
1/1=1
math

mild bloom
#

you could make a part follow a player at an offset with math

local playerPositon = --player posion thingys

local part = Instance.new("part")
part.Parent = workspace

local offset = Vector3.new(0, 10, 0)

part.Postion  = playerPostion + offset
#

you would need to put it in a loop

#

but thats a simple way of using math to do smt

echo berry
#

@potent wagon look youre right but in coding placeholders are one of the most important thing. i mean u can print just 2 but coding is basically just math in words.

#

u need to use placeholder/variables for good games

echo berry
mild bloom
#

its just following the player

#

rotation doesnt matter

echo berry
echo berry
mild bloom
mild bloom
# echo berry 🤦
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local rootPart = character:WaitForChild("HumanoidRootPart")

local part = Instance.new("Part")
part.Size = Vector3.new(2, 2, 2)
part.Anchored = true
part.CanCollide = false
part.BrickColor = BrickColor.new("Bright red")
part.Parent = workspace

local offset = Vector3.new(0, 10, 0)

RunService.Heartbeat:Connect(function()
    local playerPosition = rootPart.Position
    part.Position = playerPosition + offset
end)
#

run the code

echo berry
#

bro i know that it works but it looks like shit

mild bloom
echo berry
#

i meant that almost no one uses Vector3 for things like that. Sorry if i didnt wrote it right

mild bloom
# echo berry bro i know that it works but it looks like shit
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local rootPart = character:WaitForChild("HumanoidRootPart")

local part = Instance.new("Part")
part.Size = Vector3.new(2, 2, 2)
part.Anchored = true
part.CanCollide = false
part.BrickColor = BrickColor.new("Bright red")
part.Parent = workspace

local offset = CFrame.new(0, 10, 0)

RunService.Heartbeat:Connect(function()
    local playerPosition = rootPart.CFrame
    part.CFrame = playerPosition * offset
end)

The code looks identical if i use cframes