Egg collecting system anti repeat system fix

Hello Everyone!

im trying to make a system so where you can collect eggs and im trying to make it so if you start it then try and click on the npc again if you dont have 10 eggs it will say you didn’t collect all of them.

but for some reason its not working it just uses the same message.

OpenGui.ProximityPrompt.Triggered:Connect(function(player)
	if CollectedEggs == 0 then
		QuestUI.Enabled = true
		SetDescription("canz u find mih eggs i lost dem 😢")
		QuestStarted = true
	elseif QuestStarted == true and CollectedEggs < 10 then
		SetDescription("noob, dont come to me when u haven't finished! go out there and get the rest!!!")
		wait(2.4)
		QuestUI.Enabled = false
	elseif CollectedEggs == 10 then
		SetDescription("u got all the eggs!")
		wait(2.4)
		QuestUI.Enabled = false
	end
end)
1 Like

dont use wait() anymore, its deprecated, use task.wait(number)

maybe you can try to print CollectedEggs before the conditionals to see if the conditionals are wrong or scripts that control CollectedEggs are wrong

1 Like

would you like to me to share the full script?

1 Like

I think this should fix the problem :slight_smile:

OpenGui.ProximityPrompt.Triggered:Connect(function(player)
	if CollectedEggs == 0 and QuestStarted == false then
		QuestUI.Enabled = true
		SetDescription("Can u find my eggs I lost dem 😢")
		QuestStarted = true
	elseif QuestStarted == true and CollectedEggs < 10 then
		SetDescription("Noob, don't come to me when u haven't finished! go out there and collect the rest!!!")
		wait(2.4)
		QuestUI.Enabled = false
	elseif CollectedEggs == 10 then
		SetDescription("U got all the eggs!")
		wait(2.4)
		QuestUI.Enabled = false
	end
end)
1 Like

it does not bring up the gui when i try to click the proxy prompt again.

1 Like

wait nvm it worked just had to do some editing!

OpenGui.ProximityPrompt.Triggered:Connect(function(player)
	if CollectedEggs == 0 and QuestStarted == false then
		QuestUI.Enabled = true
		SetDescription("Can u find my eggs I lost dem 😢")
		QuestStarted = true
	elseif QuestStarted == true and CollectedEggs < 10 then
		SetDescription("Noob, don't come to me when u haven't finished! go out there and collect the rest!!!")
		QuestUI.Enabled = true
		wait(2.4)
		QuestUI.Enabled = false
	elseif CollectedEggs == 10 then
		SetDescription("U got all the eggs!")
		QuestUI.Enabled = true
		wait(2.4)
		QuestUI.Enabled = false
	end
end)

i had to enable the gui

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.