Talk:How To Increase and Decrease Vector3 Values

From Legacy Roblox Wiki
Jump to navigationJump to search

Testing

local value = {script.Parent.Value}
local i = 1
local x = value[i].x
local y = value[i].y
local z = value[i].z
x = x + 5
y = y + 5
z = z + 5
script.Parent.Value = Vector3.new(x,y,z)
print(script.Parent.Value)

and

local value = {script.Parent.Value}
local i = 1
local x = value[i].x
local y = value[i].y
local z = value[i].z
x = x - 5
y = y - 5
z = z - 5
script.Parent.Value = Vector3.new(x,y,z)
print(script.Parent.Value)
Vector2 = {} --this declares an object of the class "Vector2" (yes, it is a table as well) 

function Vector2.new(one, two) --the function that we will use to create new objects of this class 
newTB = {x, y} --this makes our new object with the properties, which you set as objects in the table 
newTB.x = one --set the value to the one called in the argument 
newTB.y = two 
return newTB 
end 


a = Vector2.new(7, 8) 
print(a.x) --> 7 
print(a.y) --> 8 
a.x = 10 
print(a.x) --> 10 

function Vector2.new(one, two) 
newTB = {x, y} 
newTB.x = one 
newTB.y = two 

function newTB.reset() 
newTB.x = 0 
newTB.y = 0 
end 

return newTB 
end 

a = Vector2.new(5, 8) 

print(a.x) --> 5 
print(a.y) --> 8 

a:reset() 

print(a.x) --> 0 
print(a.y) --> 0 

work. MINDRAKER 05:18, 26 August 2008 (CDT)