I have a MouseoverText LocalScript, its basically a textlabel that follows the mouse when it points to a part, I made a magnitude for it so you will only see it when youre near it,but its not working, please help me ty
the part 1 of the magnitude is the player head since its a first person game and the part 2 is the mouse target
script:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local label = script.Parent
local target = mouse.Target
local range = 10
local head = player.Character:WaitForChild("Head")
function updatePos ()
local X = mouse.X
local Y = mouse.Y
if target and target:FindFirstChild("MouseoverText") and (head.Position - target.Position).magnitude <= range then
label.Position = UDim2.new(0.01,X,0.01,Y)
label.Text = target.MouseoverText.Value
label.Visible = true
else
label.Visible = false
end
end
mouse.Move:Connect(updatePos)
updatePos()

1 comment
.magnitude also works. Capitalization doesn’t matter.