So, I have a script that already works but I am having trouble trying to figure out how to rotate/set its orientation to tween properly upward.
local MousePosition = Character:WaitForChild("GetMouse"):InvokeClient(Player)[1]
local FarAhead = Instance.new("Part")
FarAhead.Name = "Hit"
FarAhead.Size = Vector3.new(1,1,1)
FarAhead.Anchored = true
FarAhead.Transparency = 1
FarAhead.BrickColor = BrickColor.new("Really red")
FarAhead.Parent = workspace.Thrown
FarAhead.CFrame = CFrame.new(HumanoidRootPart.Position + MousePosition.LookVector * 120)
local RealBeam = ReplicatedStorage.Effects.BeamWave.BeamPart:Clone()
RealBeam.Parent = workspace.Thrown
RealBeam.CFrame = HumanoidRootPart.CFrame * CFrame.new(0,0,-1) * CFrame.Angles(0,math.rad(90),0)
local Y_INCREMENT = 0;
local X_INCREMENT = (RealBeam.Position - FarAhead.Position).Magnitude;
local Z_INCREMENT = 0;
local Goal = {
Size = RealBeam.Size + Vector3.new(X_INCREMENT, Y_INCREMENT, Z_INCREMENT),
CFrame = RealBeam.CFrame * CFrame.new(X_INCREMENT / 2, 0, 0)
}
local BeamTween = TweenService:Create(RealBeam, TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.In), Goal);
BeamTween:Play()
For example, if I aim the mouse upwards like 60 studs above the player, how do I make it properly rotate upward to it?
I’m making a energy beam from DBZ if that helps explain it better.