Production-ready Roblox scripts. Copy, paste, and customize for your game. Each module is self-contained and battle-tested.
Robust data persistence with auto-save, session locking, exponential backoff retry, and data versioning. Drop-in solution for player data.
--[[
DataStore Manager v2.0
by rblxdev.com
A robust data persistence system with auto-save, session locking,
retry logic, and data versioning. Drop into ServerScriptService.
]]
local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")
local DataManager = {}
DataManager.__index = DataManager
local CONFIG = {
DataStoreName = "PlayerData_v1",
AutoSaveInterval = 300,
MaxRetries = 5,
RetryDelay = 1,
}
local dataStore = DataStoreService:GetDataStore(CONFIG.DataStoreName)
local playerData = {}
local dataTemplate = {}
local function deepCopy(original)
local copy = {}
for key, value in pairs(original) do
if type(value) == "table" then
copy[key] = deepCopy(value)
else
copy[key] = value
end
end
return copy
end
local function reconcile(data, template)
for key, value in pairs(template) do
if data[key] == nil then
if type(value) == "table" then
data[key] = deepCopy(value)
else
data[key] = value
end
elseif type(data[key]) == "table" and type(value) == "table" then
reconcile(data[key], value)
end
end
return data
end
function DataManager.SetTemplate(template)
dataTemplate = template
end
function DataManager:LoadData(player)
local key = "Player_" .. player.UserId
local success, data = pcall(function()
return
-- ... (full script available via download)Server-authoritative combat with hit detection, combos, critical hits, knockback physics, and damage falloff. Built for competitive games.
--[[
Combat System v1.5
by rblxdev.com
Server-authoritative combat system with hit detection,
combos, and damage calculation. Place in ServerScriptService.
]]
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Combat = {}
Combat.__index = Combat
local weapons = {}
local playerCooldowns = {}
local playerCombos = {}
function Combat:RegisterWeapon(name, config)
weapons[name] = {
Damage = config.Damage or 10,
Range = config.Range or 5,
Cooldown = config.Cooldown or 1,
CritChance = config.CritChance or 0.1,
CritMultiplier = config.CritMultiplier or 1.5,
KnockbackForce = config.KnockbackForce or 20,
ComboWindow = config.ComboWindow or 0.5,
MaxCombo = config.MaxCombo or 3,
}
end
function Combat:Attack(attacker, weaponName, targetPosition)
local weapon = weapons[weaponName]
if not weapon then return end
local attackerChar = attacker.Character
if not attackerChar then return end
-- Cooldown check
local lastAttack = playerCooldowns[attacker.UserId]
if lastAttack and (os.clock() - lastAttack) < weapon.Cooldown then
return
end
playerCooldowns[attacker.UserId] = os.clock()
-- Find targets in range
local attackerRoot = attackerChar:FindFirstChild("HumanoidRootPart")
if not attackerRoot then return end
for _, player in ipairs(Players:GetPlayers()) do
-- ... (full script available via download)Flexible inventory with item stacking, categories, weight limits, equip slots, and metadata support. Ready for RPG and survival games.
--[[
Inventory System v1.3
by rblxdev.com
Flexible inventory system with stacking, categories,
and equip slots. Place in ServerScriptService.
]]
local Players = game:GetService("Players")
local Inventory = {}
Inventory.__index = Inventory
local itemDefinitions = {}
local playerInventories = {}
local CONFIG = {
MaxSlots = 40,
MaxWeight = 100,
}
function Inventory:RegisterItem(itemId, definition)
itemDefinitions[itemId] = {
Id = itemId,
DisplayName = definition.DisplayName or itemId,
Category = definition.Category or "Misc",
MaxStack = definition.MaxStack or 1,
Weight = definition.Weight or 1,
Rarity = definition.Rarity or "Common",
}
end
function Inventory:InitPlayer(player)
playerInventories[player.UserId] = {
Items = {},
Equipped = {},
}
end
function Inventory:AddItem(player, itemId, quantity)
local inv = playerInventories[player.UserId]
local def = itemDefinitions[itemId]
if not inv or not def then return false end
quantity = quantity or 1
-- Find existing stack or empty slot
for i = 1, CONFIG.MaxSlots do
local slot = inv.Items[i]
if slot and slot.ItemId == itemId and slot.Quantity < def.MaxStack then
local canAdd = math.min(quantity, def.MaxStack - slot.Quantity)
slot.Quantity = slot.Quantity + canAdd
quantity = quantity - canAdd
if quantity <= 0 then return true
-- ... (full script available via download)Complete quest/mission system with multiple objective types, prerequisites, rewards, and progress tracking. Perfect for RPGs and adventure games.
--[[
Quest System v1.2
by rblxdev.com
Flexible quest system with objectives, rewards,
and prerequisites. Place in ServerScriptService.
]]
local Players = game:GetService("Players")
local QuestSystem = {}
QuestSystem.__index = QuestSystem
local questDefinitions = {}
local playerQuests = {}
function QuestSystem:RegisterQuest(questId, definition)
questDefinitions[questId] = {
Id = questId,
Title = definition.Title or questId,
Description = definition.Description or "",
Objectives = definition.Objectives or {},
Rewards = definition.Rewards or {},
Prerequisites = definition.Prerequisites or {},
Repeatable = definition.Repeatable or false,
}
end
function QuestSystem:InitPlayer(player)
playerQuests[player.UserId] = { Active = {}, Completed = {} }
end
function QuestSystem:StartQuest(player, questId)
local def = questDefinitions[questId]
local data = playerQuests[player.UserId]
if not def or not data then return false end
if data.Active[questId] then return false end
local objectives = {}
for i, obj in ipairs(def.Objectives) do
objectives[i] = {
Type = obj.Type,
Target = obj.Target,
Required = obj.Amount,
Current = 0,
Completed = false,
}
end
data.Active[questId] = { Objectives = objectives, StartTime = os.time() }
return true
end
function QuestSystem:ReportProgress(play
-- ... (full script available via download)Game round management for competitive multiplayer. Handles lobbies, countdowns, scoring, win conditions, and map rotation.
--[[
Round System v1.1
by rblxdev.com
Game round management for competitive games.
Place in ServerScriptService.
]]
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RoundSystem = {}
RoundSystem.__index = RoundSystem
local currentPhase = "Waiting"
local roundNumber = 0
local scores = {}
local isRunning = false
local CONFIG = {
IntermissionTime = 15,
CountdownTime = 5,
RoundTime = 180,
PostRoundTime = 10,
MinPlayers = 2,
WinCondition = "LastStanding",
}
function RoundSystem:Configure(config)
for key, value in pairs(config) do
if CONFIG[key] ~= nil then CONFIG[key] = value end
end
end
function RoundSystem:Start()
if isRunning then return end
isRunning = true
task.spawn(function()
while isRunning do
-- Wait for players
while #Players:GetPlayers() < CONFIG.MinPlayers do
task.wait(1)
end
-- Intermission
currentPhase = "Intermission"
task.wait(CONFIG.IntermissionTime)
-- Countdown
currentPhase = "Countdown"
task.wait(CONFIG.CountdownTime)
-- Active round
currentPhase = "Active"
roundNumber = roundNumber + 1
scores = {}
for _, p in ipairs(Players:GetPlayers()) do
scores[p.UserId] = { Kills = 0, De
-- ... (full script available via download)Pathfinding-based NPC with behavior states, aggro management, patrol routes, and loot drops. Great for RPGs and adventure games.
--[[
NPC AI System v1.0
by rblxdev.com
Pathfinding NPC with behavior states.
Place in ServerScriptService.
]]
local PathfindingService = game:GetService("PathfindingService")
local Players = game:GetService("Players")
local NPCSystem = {}
local NPC = {}
NPC.__index = NPC
local activeNPCs = {}
function NPCSystem:CreateNPC(id, config)
local npc = setmetatable({}, NPC)
npc.Id = id
npc.Model = config.Model
npc.MaxHealth = config.MaxHealth or 100
npc.Health = npc.MaxHealth
npc.Damage = config.Damage or 10
npc.AttackRange = config.AttackRange or 5
npc.AggroRange = config.AggroRange or 20
npc.MoveSpeed = config.MoveSpeed or 16
npc.State = "Idle"
npc.Target = nil
npc.PatrolPoints = config.PatrolPoints or {}
npc.SpawnPosition = config.Model.PrimaryPart.Position
npc.IsActive = false
activeNPCs[id] = npc
return npc
end
function NPC:Activate()
self.IsActive = true
task.spawn(function()
while self.IsActive and self.Health > 0 do
self:Update()
task.wait(0.3)
end
end)
end
function NPC:Update()
local myPos = self.Model.PrimaryPart.Position
-- Find nearest player in aggro range
local nearest, nearestDist = nil, self.AggroRange
for _, player in ipairs(Players:GetPlayers()) do
local char = player.Character
if char and char:FindFirstChild("HumanoidRootPart") then
local dist = (char.HumanoidRootPart.Position
-- ... (full script available via download)Client-side notification system with multiple styles, smooth animations, queue management, and progress indicators.
--[[
UI Notification System v1.0
by rblxdev.com
Client-side notifications with animations.
Place in StarterPlayerScripts.
]]
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local Notifications = {}
local activeNotifications = {}
local STYLES = {
Info = { Color = Color3.fromRGB(59, 130, 246), Icon = "ℹ" },
Success = { Color = Color3.fromRGB(34, 197, 94), Icon = "✓" },
Warning = { Color = Color3.fromRGB(234, 179, 8), Icon = "⚠" },
Error = { Color = Color3.fromRGB(239, 68, 68), Icon = "✕" },
Achievement = { Color = Color3.fromRGB(168, 85, 247), Icon = "★" },
}
local screenGui
local function createUI()
if screenGui then return end
screenGui = Instance.new("ScreenGui")
screenGui.Name = "Notifications"
screenGui.ResetOnSpawn = false
screenGui.DisplayOrder = 100
screenGui.Parent = playerGui
end
function Notifications:Show(data)
createUI()
local style = STYLES[data.Type or "Info"]
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 300, 0, 60)
frame.Position = UDim2.new(1, 20, 0, #activeNotifications * 70 + 10)
frame.BackgroundColor3 = Color3.fromRGB(30, 30, 40)
frame.Parent = screenGui
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 8)
corner.Parent = frame
local title = Instance.new("Tex
-- ... (full script available via download)These are simplified versions. Full production scripts with all features are available through my development services.
Request Custom Development