Laser Homing not working properly

okay well then also try this:

local tween = TweenService:Create(c,tweenInfo,{CFrame = CFrame.new(pos3,pos2)})
2 Likes

after a few changes i got this

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService 		= game:GetService("TweenService")
--
local function laser()
	if workspace[workspace.char.Value.Name].ClassName == "Model" then 
		if workspace.char.Value:FindFirstChild("HumanoidRootPart") then
			local extension = 30
			local speed 	= 100

			local c 		= ReplicatedStorage:WaitForChild("dead"):Clone()
			local pos1 		= script.Parent.Position
			local pos2 		= workspace.char.Value.HumanoidRootPart.Position

			local direction = (pos2 - pos1).Unit
			local pos3 = pos2 + (direction * extension)

			local fullDistance = (pos1 - pos3).Magnitude
			c.Parent = workspace
			c.CFrame = CFrame.new(pos3,pos2)
			c.Position = script.Parent.Position
			local t = fullDistance / speed
			local tweenInfo = TweenInfo.new(t,Enum.EasingStyle.Linear)
			local tween = TweenService:Create(c,tweenInfo,{CFrame = CFrame.new(pos3,pos2)})
			tween:Play()
		end
	end
end

while true do
	laser()
	task.wait(3)
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.