Hi, last time I made a post was about me not able to rotate/resize things properly, as I was trying to make a statue that shoots lasers from his eyes on other parts. (screenshot below). Well I tried rotating the eyes and then resizing the laser but that didn’t really work out and I bet there has to be some cleaner/better/simpler way to achieve that.
I need to move the laser to a different Part each let’s say 5 seconds.
Obviously adjust the size too, so it can reach the Part.
My last attempt looked like this, i figured out the “moving” part only not the resizing. But it looks way too chaotic at my opinion, and would like to see some other approaches.
local laserSize = {
Vector3.new(0,0,0),
Vector3.new(48.8, 0.2, 0.2), --Pillar 1
Vector3.new(62.75, 0.2, 0.2),
Vector3.new(79.351, 0.2, 0.2),
Vector3.new(93.65, 0.2, 0.2),
Vector3.new(116.55, 0.2, 0.2),
Vector3.new(154.05, 0.2, 0.2),
Vector3.new(154.05, 0.2, 0.2)-- Pillar 7
}
local rightEyeRot = {
Vector3.new(0,0,0),
Vector3.new(-68.26, 59.27, 144.84), --Pillar 1
Vector3.new(-47.73, 58.37, 166.82),
Vector3.new(-54.09, 65.47, 153.54),
Vector3.new(-66.92, 55.09, 150.28),
Vector3.new(-66.92, 55.09, 150.28),
Vector3.new(-73.98, 74.48, 131.95),
Vector3.new(-75.93, 85.72, 118.59) -- Pillar 7
}
local leftEyeRot = {
Vector3.new(0,0,0),
Vector3.new(-74.76, -16.21, -173.42), --Pillar 1
Vector3.new(-63.71, -27.15, -160.53),
Vector3.new(-73.02, -40.65, -145.43),
Vector3.new(-78.6, -67.54, -122.3),
Vector3.new(-78.6, -67.54, -122.3),
Vector3.new(-79.78, -104.99, -79.46),
Vector3.new(-78.11, -126.98, -57.87) -- Pillar 7
}
local Model = script.Parent
local leftEye = Model:WaitForChild("leftEye")
local leftEyeLaser = leftEye:WaitForChild("leftEyeLaser")
local ClickDetector = Model:WaitForChild("CD"):WaitForChild("ClickDetector")
ClickDetector.MouseClick:Connect(function(player)
local leftEyeOffset = leftEye.CFrame:Inverse() * leftEyeLaser.CFrame
local rng = math.random(3,8)
leftEye.Orientation = leftEyeRot[rng]
leftEyeLaser.CFrame = leftEye.CFrame * leftEyeOffset
--Resize the leftEyeLaser somehow, use the Vec3 array laserSize.
end)
Thank you.