local EggOpener = script.Parent
wait(1)
local char = game.Workspace:WaitForChild("Character")
local humRoot = char.HumanoidRootPart
local Magnitude = (humRoot.Position- EggOpener.Position).magnitude
print(Magnitude)
17:10:49.959 Infinite yield possible on ‘Workspace:WaitForChild(“Character”)’ - Studio
local script in starterplayerscripts
look
using this code mean("character")your looking for something called character
using this code mean (character.Name)your looking for opject have same name with player character
Here is a better way to test the magnitude you wanted
local Players= game:GetService("Players")
local Player = Player.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local EggOpener = script.Parent --// Im unsure about this...
While true do
wait(1)
local Magnitude = (HumanoidRootPart .Position- EggOpener.Position).magnitude
print(Magnitude)
end
local player = game.Players.LocalPlayer
repeat wait() player:FindFirstChild(Character) until player:FindFirstChild(Character) ~= nil
local Character = player:FindFirstChild(Character)