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?
"Infinite Yeild Possible" shows when WaitForChild has been yeilding the code for a susiciously long time, you are searching the player object for the head, not the character in the workspace like you should be when searching for limbs, line 5 is:
local head = player:WaitForChild("Head")
line 5 should be:
local head = player.Character:WaitForChild("Head")