Comments: So this is for a set of lasers, Im attempting to make it so when a single laser piece (using Ray.new) would resize if it found a part.Do rays operate with meshs? Unless Im standing on the part itself the ray will resize the laser to default 250.
RECOMMENDED TO LOOK AT THE PROPERTIES
**Part Properties: ** http://prntscr.com/dnqg3u
Ray Module:
-- Vars --
local CollisionRange = 250
local IgnoreList = {}
-- Add table data --
-- Returning function --
return function(Part)
local nRay = Ray.new(
Part.Position,
Part.CFrame.lookVector * CollisionRange
)
local Hit, CollisionPoint = workspace:FindPartOnRayWithIgnoreList(
nRay,
{
Part.Parent
}
)
local Size = (Part.Position-CollisionPoint).magnitude
local Offset = (Size/10)
return{
['Size']=Size,
['Offset']=Offset
}
end
LocalScript:
local Model = workspace:WaitForChild("Test")
local nRay = require(script:WaitForChild("Ray"))
game:GetService("RunService").RenderStepped:connect(function()
for _,v in next,Model:GetChildren() do
local Data = nRay(v)
local Size = Data.Size
local Offset = Data.Offset
v.Mesh.Scale = Vector3.new(Size, .5, .5)
v.Mesh.Offset = Vector3.new(Offset, 0, 0)
end
end)
