Hi,
So i have a compass and i want its arrow show the way to a part. I tryed many ways and stopped at
But this script always shows to the front of the part, but i want it to show to a part. how to make it show to a part?
while true do
local RotTo = workspace:FindFirstChild("Part")
script.Parent.Arrow.Orientation = RotTo.Orientation
wait()
end
I am unsure for what you are asking. Do you want the compass arrow to point to the RotTo part, or to have the same rotation as the RotTo part?
Also, side note, using wait() in a while true loop is bad for these reasons: Avoiding wait() and why
So I did some experimenting and this is what I came up with:
In a LocalScript within a tool:
local part = Instance.new("Part")
part.Anchored = true
part.CanCollide = false
part.FrontSurface = Enum.SurfaceType.Hinge
part.Parent = workspace.CurrentCamera
script.Parent.Handle.Transparency = 1
local runService = game:GetService("RunService")
while true do
runService.RenderStepped:Wait()
part.CFrame = CFrame.new(script.Parent.Handle.Position, workspace.lookAtMe.Position)
end
What I found is that the arrow part cannot be in the tool object, and it has to be anchored with collisions off. In order for it to work smoothly, you have to use RunService.RenderStepped:Wait(), and not wait()
It is the arrow part, sorry I didn’t explain that. It cannot be in the tool or else it will glitch the player like what happened before. Mine is very rudimentary with just basic parts, you would have to apply this system to however your tool is made up (arrowPart, handle)