How do i make a frame in gui navigate the position of a npc?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

Tool that make a gui appear when activated and the gui has a frame that somehow teleports into the position of an npc but it dissapears when the npc is out of the screen.

  1. What is the issue? Include screenshots / videos if possible!

I dont know how to make a frame go to the position of a npc.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I dont know how its called so no.

I’ve found a solution that might help you.

Im gonna try that script i think it should work.

1 Like

For some reason it doesnt work

local part = workspace.Monsters.Siren_Head.HumanoidRootPart
local camera = workspace.CurrentCamera
local worldPoint = part.Position
local vector = camera:WorldToScreenPoint(worldPoint)

local screenPoint = UDim2.new(0, vector.X, 0, vector.Y)
local depth = vector.Z

while true do
	script.Parent.Show.ThePosition.Position = screenPoint
	task.wait(1)
end

They don’t work because you have a variable that is outside of loop, which does not vary and stays there with the same position.

So maybe put both vector and screenPoint into the loop.

Still doesnt work maybe i should put the local script inside.

Yeah, it has to be in local script.

I needed to change some values and now it works

local part = workspace.Monsters.Siren_Head.Head
local camera = workspace.CurrentCamera
local worldPoint = part.Position

while true do
	local vector = camera:WorldToScreenPoint(worldPoint)
	local screenPoint = UDim2.new(0, vector.X - 50, 0, vector.Y - 50)
	script.Parent.Position = screenPoint
	task.wait(.1)
end
1 Like