I am making a game called Meme Simulator and the i made a button for the rebirths menu but when i click it it doesnt pop up.Also in the output it said infinite yield possible. This is my script

local replicatedStorage = game:GetService("ReplicatedStorage")
local starterRebirthAmount = 1000

local player = game.Players.LocalPlayer
local mainFrame = script.Parent:WaitForChild("MainFrame")
local rebirthMenu = mainFrame:WaitForChild("RebirthMenu")
local mainButton = script.Parent:WaitForChild("MainButton")
local rebirthButton = rebirthMenu:WaitForChild("RebirthButton")
local memesToRebirth = rebirthMenu:WaitForChild("MemesToRebirth")
local rebirths = player:WaitForChild("leaderstats").Rebirths


memesToRebirth.Text = "You need at least "..math.floor((starterRebirthAmount + (rebirths.Value) * math.sqrt(4))).."Memes to rebirth"

mainButton.MouseButton1Click:Connect(function()
	mainFrame.Visible = not mainFrame.Visible
end)

rebirthButton.MouseButton1Click:Connect(function()
	local result = replicatedStorage.Remotes.Rebirth:InvokeServer()
	
	if result == true then
		rebirthButton.Text = "Succesfully Rebirthed, Make more memes"
		wait(2)
		rebirthButton.Text = "CLICK HERE TO REBIRTH"
	elseif result == "Notenoughmemes" then
		rebirthButton.Text = "Make more memes"
		wait(2)
		rebirthButton.Text = "CLICK HERE TO REBIRTH"
	end
end)

rebirths:GetPropertyChangedSignal("Value"):Connect(function()
	memesToRebirth.Text = "You need atleast "..math.floor((starterRebirthAmount + (rebirths.Value) * math.sqrt(4))).."Memes to rebirth"

end)

In line 9 it said there was a error. The error said Infinite yield possible on 'Players.AccidentalDave123.PlayerGUI.Main.MainFrame.RebirthMenu:WaitForChild("MemesToRebirth")

I dont know how to fix the yield or how to fix the rebirth GUI. (If your wondering yes I did make a frame for the GUI but it doesnt show up when I click the rebirths menu button)

2 comments

0

Infinte Yield Means , That It is Not There , And That The Script Will "Yield" Or Stop On That Line Until it finds the "MemesToRebirth" thing

0

It simply Means that on line 9 the script is waiting for "MemesToRebirth" to be there , so basiclly that means , it is not there or hasnt been created yet !