-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObject.lua
More file actions
33 lines (26 loc) · 693 Bytes
/
Object.lua
File metadata and controls
33 lines (26 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
local Object = {}
local function generatePart(pos)
local part = Instance.new("Part")
part.Size = Vector3.new(1,1,1)
part.Anchored = true
part.Position = pos
return part
end
Object.new = function(pos : Vector3)
local self = {}
local position = pos or Vector3.new(0,0,0)
local originPart = generatePart(position)
local is_spawned = false
function self:SetSpawned(state : boolean)
if state ~= nil then
is_spawned = state
else
is_spawned = not is_spawned
end
end
function self:SetPosition(position : Vector3)
originPart.Position = position
end
return self
end
return Object