0

# Problems with pop up egg frame?

Hi! I have two eggs that when you get close to it a gui pops up telling you all the eggs that you can buy. With one egg it works fine, but with two eggs it doesn’t work. Please tell me what I have done wrong.

Local Script:

game:GetService("RunService").RenderStepped:Connect(function()
for i, v in pairs(workspace:WaitForChild("Eggs"):GetChildren()) do
local char = plr.Character or plr.CharacterAdded:Wait()
local Magnitude = (v.Egg.Position - char:WaitForChild("HumanoidRootPart").Position).magnitude

if Magnitude <= 8 then
if plr.PlayerGui.MainGUI.EggFrame.Visible == false then
db = false
plr.PlayerGui.MainGUI.EggFrame.Visible = true
local vector, onScreen = camera:WorldToScreenPoint(v.GuiPart.Position)
plr.PlayerGui.MainGUI.EggFrame.Position = UDim2.new(0,vector.X - 100,0,vector.Y - 180)

plr.PlayerGui.MainGUI.EggFrame.Egg.Value = v.Name
print("Near An Egg")

end

else
db = true
plr.PlayerGui.MainGUI.EggFrame.Visible = false
plr.PlayerGui.MainGUI.EggFrame.Egg.Value = ""

end

end
end)