Start building

Roblox AFK Zone Reward Script (Auto Coin Payout Loop)

Uses reliable spatial queries (GetPartsInPart) instead of buggy TouchEnded events to grant periodic coins to players in an AFK area.

Type: ScriptExplorer: ServerScriptServiceLevel: Intermediate
ScriptServerScriptService
-- Script in ServerScriptService
local Players = game:GetService("Players")

local zone = workspace:WaitForChild("AFKZone") :: BasePart
local INTERVAL = 10
local REWARD = 5

task.spawn(function()
	while true do
		task.wait(INTERVAL)
		local awarded: { [Player]: boolean } = {}
		for _, part in ipairs(workspace:GetPartsInPart(zone)) do
			local player = Players:GetPlayerFromCharacter(part.Parent)
			if player and not awarded[player] then
				awarded[player] = true
				local coins = player:FindFirstChild("leaderstats") and player.leaderstats:FindFirstChild("Coins")
				if coins then coins.Value += REWARD end
			end
		end
	end
end)

How to install in Studio

  1. Create a transparent, non-collidable, anchored Part named AFKZone covering your AFK area.
  2. Put this Script in ServerScriptService.
  3. Players standing inside AFKZone receive +5 Coins every 10 seconds.

Tips & customization

  • Double the reward for Roblox Premium members with `if player.MembershipType == Enum.MembershipType.Premium then`!

Common questions.

Why use GetPartsInPart instead of Touched/TouchEnded?

TouchEnded fires inconsistently when characters jump or animate; GetPartsInPart is 100% accurate every tick.

More free Luau scripts.

All 16 scripts

Skip manual wiring.
Let Revix code & playtest it.

Start building free

Free to start. No card needed.