Proximity prompt stops working after 10 mins

Hello, my name is tum. I am making a game about fighting with swords. There is a lobby with sword equippers. You can unlock the swords by waiting in game or having badges. (each second gives 1-4 time)

However, I’ve noticed a CRITICAL ISSUE, that is ruining the entire game. After you play for around 10 or 20 minutes, you stop generating time or you cant equip the swords besides default (the one that is activated on join. (by activated i mean the swords are equipped with proximity prompts, which are by default set to enabled)

I’ve been trying to fix this for so long, but i cant find anyone addresing this.

Here’s my time script:


local time_currency = 0

local ui = script.Parent

local plr_service = game:GetService("Players")

local plr = plr_service.LocalPlayer

local gen_enabled = false

local cd = 1
if plr.UserId == 1448958151 then
	ui.time_label.Text = "tum mode!! 😭🙏"
	cd = 0.01
end

if gen_enabled == false then
    while true do
		time_currency += math.random(1,4)
		ui.time_label.Text = "time: ".. time_currency
		if time_currency > 249 then
			game.Workspace.equips.equip_throw.ProximityPrompt.Enabled = true
		end
		if time_currency > 499 then
			game.Workspace.equips.equip_camera.ProximityPrompt.Enabled = true
		end
		if time_currency > 749 then
			game.Workspace.equips.equip_ice.ProximityPrompt.Enabled = true
		end
		if time_currency > 999 then
			game.Workspace.equips.equip_beam.ProximityPrompt.Enabled = true
		end
		task.wait(cd)
	end
end

Here’s my badge sword code:


local plr = game:GetService("Players")

local id = plr.LocalPlayer.UserId

local plr_l = game.Players.LocalPlayer

local badge_gen = true

while true do
	if BadgeService:UserHasBadgeAsync(id, 371761960492786) then
		game.Workspace.equips.equip_barrier.ProximityPrompt.Enabled = true
	end
		if BadgeService:UserHasBadgeAsync(id, 506902204788348) then
		game.Workspace.equips.equip_dismantle.ProximityPrompt.Enabled = true
	end
	task.wait(10)
end

Equip script: (basically the same for every sword)

script.Parent.Triggered:Connect(function(pleyer) -- pleyer??
	local copy_of_sword = game.ReplicatedStorage.swords.dismantle:Clone()
	copy_of_sword.Parent = pleyer.Backpack
	pleyer.Character:FindFirstChild("HumanoidRootPart").Position = game.Workspace.arena_tp.Position
end)

Please help me fix this. :sob::sob::sob::pray:

Hi,

Could you provide some additional information on exactly what stops working? Do the proximity prompts stop showing up? Does activating the proximity prompts no longer give the player the tool? Does the time value stop incrementing on the text label?

There could be a memory leak in your game causing the server to have a very delayed reactions, like in one game I saw the server was very slow and carts took like 10 minutes to regenerate.

They don’t show up even if Enabled is set to true.