How to make this attachement orientation similar to the camera orientation for a projectile (script+video)

  1. What do you want to achieve?
    Hello, on the video below you can see that the CFrame of the growing projectile is connected to the CFrame of an attachment, which determines where the projectile will grow. I would like to find a way to make the orientation of the attachment similar to the orientation of the camera so that the projectile grows in the direction of the camera. I have tried different scripts without success, any help is greatly appreciated. Thanks for reading, you can find below script and video

- Video + Script :

		local pierre = rs.Vehicule.FuturisticBalle.BalleFuturistic:Clone()
		pierre.Parent = workspace.Route.Players[plr.UserId..''].Balles
		connexionBalle = Runs.RenderStepped:Connect(function()
			if workspace.Route.Players[plr.UserId..''].Armes:FindFirstChild('ArmeFuturisctic') then
				pierre.Grossissement.Size = Vector3.new(pierre.Grossissement.Size.X +0.1, pierre.Grossissement.Size.Y, pierre.Grossissement.Size.Z)
				pierre.Grossissement.CFrame = workspace.Route.BallePosition.WorldCFrame * CFrame.new(-pierre.Grossissement.Size.X / 2, 0, 0)
				pierre.Touch.ManualWeld.C1 = CFrame.new(-pierre.Grossissement.Size.X / 2,0,0)
				local x, y, z = camera.CFrame:ToEulerAnglesYXZ()
				workspace.Route.BallePosition.CFrame = workspace.Route.BallePosition.CFrame * CFrame.Angles(math.rad(x),math.rad(y),math.rad(z))
			else
				if connexionBalle ~= nil then
					connexionBalle:Disconnect()
					connexionBalle = nil
				end
			end
		end)
1 Like