Hi guys, I'm trying to make an arrow which stays in front of the player and rotates to follow a brick.
I have managed to do that, but have a problem.
game.Workspace.ARROW.Position = workspace:FindFirstChild(game.Players.LocalPlayer.Name).Head.Position + Vector3.new(0, 3, -6)
This sets the position and is correct - it stays in front of the player and is fine when the player walks about.
Now, to face the part I do this:
game.Workspace.ARROW.CFrame = CFrame.new(game.Workspace.ARROW.Position, Vector3.new(game.Workspace.Part.Position.X, game.Workspace.ARROW.Position.Y,game.Workspace.Part.Position.Z))
But the problem is, it now doesn't stay in front of the player.
Any ideas how I can keep the arrow in front of the player and rotate on the point, rather than rotating around the player if that makes sense?
Thanks!
You can set the arrow infront of the player by using the lookVector of the head, then you can rotate it to look at the goal using the second CFrame argument.
Here's an example:
local Head = Character.Head local Goal = workspace.Goal game:GetService("RunService").RenderStepped:Connect(function() Part.CFrame = CFrame.new( --Positioning Head.Position + --Head Position Head.CFrame.lookVector * 5 + -- 5 Studs off from the center of their head. Vector3.new(0,-2,0) -- 2 Studs lower so it's not directly infront of their head. , -- Enter 2nd argument of CFrame Goal.Position --LookingAt (Rotation) ) end)