The issue: http://prntscr.com/dnh585
Comments: If I disable the v.LightModel cframing (Z) the laser is fine, otherwise the laser top goes crazy and goes somewhere into nothingness. Help? Or maybe a explanation?
The code:
local UpdateRotation = function(Db)
for _,v in next,Compression do
local Data = OldPos[v]
if Data then
local Y_CFrame = Data*CFrame.Angles(0, math.sin(tick())/2, 0)
local Z_CFrame = v.LightModel:GetPrimaryPartCFrame()*CFrame.Angles(0, 0, math.sin(tick())/2)*CFrame.Angles(0, 0, Db)
v.LightModel:SetPrimaryPartCFrame(Z_CFrame)
v:SetPrimaryPartCFrame(Y_CFrame)
end
end
end
spawn(function()
RenderStepped:connect(function()
local Db = Abs(Sound.PlaybackLoudness/130)/20
UpdateRotation(Db)
end)
end)
