Ep 5. Auto Clicker stopped Working

Many people have reported issues of their auto-clicker no longer working after they use it a single time or rejoin the game. Surprisingly, this isn’t actually an issue, but rather a very poor job explaining the functionality on my end.

Before we created the auto clicker, we added the Auto table to the player’s data located inside of the ServerScriptService/PlayerData/Template module. When the player activates their Fast or Regular auto clicker, we will begin to reduce their Duration property with each second.

So when you go into your game and test out the auto-clicker, you will likely use the entire duration. Once you rejoin your game, you cannot turn the auto clicker on. This is because the auto clicker is not infinite.

Setting the initial Auto Clicker Duration

If you would like for players to be able to use the auto clicker upon joining the game, then we will need to modify the default player data. We can make the following changes inside of the ServerScriptService/PlayerData/Template module.

ServerScriptService/PlayerData/Template.lua
local DEFAULT_AUTO_INFO = {
	Active = false,
	Duration = 0
}

local Template = {
	Clicks = 0,
	Gems = 0,
	Auto = {
		Fast = DEFAULT_AUTO_INFO,
		Regular = DEFAULT_AUTO_INFO
	},
}

-- Another example which gives new players
-- 60 seconds of the Fast auto clicker.

local Template = {
	Clicks = 0,
	Gems = 0,
	Auto = {
		Fast = {
			Active = false,
			Duration = 60 -- 60 seconds
		},
		Regular = DEFAULT_AUTO_INFO
	},
}

Resetting the Auto Clicker

In order to reset the auto clicker duration after it has been used, we’d recommend you reset your entire player data. This is recommended because you’re still quite early on in the development phase of this game and player data is not to be cared about. You’ll be constantly resetting this while following the guide.

There are two ways of resetting the player data:

Setting the Auto Clicker

We can modify the Duration property of the specific auto click of the player’s data in order to give them time to use their auto clicker. I realize that I should have gone over this in the video, but unfortunately I did not.

Below is a code snippet of how you could increase the player’s auto clicker duration:

ServerScriptService/AutoClick.server.lua
local function GiveAutoClickerDuration(player: Player, buttonType: "Fast" | "Regular", duration: number)
	local profile = PlayerData.Profiles[player]
	if not profile then return end
	
	profile.Data.Auto[buttonType].Duration = duration
end

Depending on your level of scripting knowledge, this may not be too helpful for you. If so, I would recommend continuing through the series and learning more about scripting and then eventually come back to this.

We have also slightly altered the auto clickers duration in a future episode where we implement the game pass. You might be able to follow along and get a further understanding of the auto clicker logic:

Contents