So I am trying to learn Magnitude by doing a simple test
local frame = script.Parent.Frame
local part = game.Workspace.Test
local players = game:GetService("Players")
local player = players.LocalPlayer
local head = player:WaitForChild("Head")
wait()
if (part.Position - player.Character.head.Position).magnitude == 10 then
frame.Visible = true
else
frame.Visible = false
end
The goal is to be if the player is 10 studs away from the part a gui will appear. I get a prompt saying, "Infinite Yield Possible On Head" but what does this mean? And more importantly, what did I do wrong?

1 comment
Headis in theirCharacter, not in the player itself. 2. Lua is case sensitive, so everything has to be spelt exactly how they are. 3. You have the player's head defined (although not from the Character), so why're you trying to get it from the player again?