--// Variables
local laser = {}
laser.__index = laser
local visibleKey = "Visible"
local DIST = 100
--// Functions
function laser.new(origin)
local newLaser = {}
newLaser.Origin = origin
return setmetatable(newLaser, laser)
end
function laser:Activate()
local function createBeam(origin)
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local raycastResult = workspace:Raycast(origin.Position, origin.CFrame.LookVector * DIST, raycastParams)
if raycastResult then
return raycastResult
end
end
self.CurrentOrigin = self.Origin
print(self.Origin.Name)
repeat wait()
local result = createBeam(self.CurrentOrigin)
if result then
print(result.Instance.Name)
self.Status = "Success"
end
until self.Status == "Success"
end
function laser.__newindex(t, k, v)
if k == visibleKey then
if v then
-- We'll do something later with these.
else
-- We'll do something later with these.
end
end
end
setmetatable(laser, {
__newindex = function(...)
laser.__newindex(...)
end,
})
return laser