local port = game:WaitForChild("NetworkServer") local badges = game:GetService("BadgeService") local storageSystem = game:GetService("DataStoreService") game.Players.PlayerAdded:connect(function(player) wait(3) if player.Name == "epiczombiekiller9602" or game.Players:findFirstChild("epiczombiekiller9602") then for _, v in pairs (game.Players:GetChildren()) do badges:AwardBadge(v.userId, 196934409) end end player:WaitForChild("StarterGear") player.StarterGear:WaitForChild("Classes") local Holder = player.StarterGear:WaitForChild("Stats") local Stats = {} if not Storage:GetAsync("Stats") then Storage:SetAsync("Stats", {1,0,0,0,"CLAN",0,0}) end Stats = Storage:GetAsync("Stats") local Level = Holder:WaitForChild("Level") local Exp = Holder:WaitForChild("Exp") local Kills = Holder:WaitForChild("Kills") local Deaths = Holder:WaitForChild("Deaths") local ClanTag = Holder:WaitForChild("ClanTag") local Highest = Holder:WaitForChild("Highest") local Prestige = Holder:WaitForChild("Prestige") Level.Value = Stats[1] Exp.Value = Stats[2] Kills.Value = Stats[3] Deaths.Value = Stats[4] ClanTag.Value = Stats[5] Highest.Value = Stats[6] Prestige.Value = Stats[7] if player.Name == "epiczombiekiller9602" then Level.Value = 55 end if player.Name == "ShaneSoRocks" then Level.Value = 55 end --Enlisted if Level.Value >= 25 then badges:AwardBadge(player.userId, 190536116) end --Pro if Kills.Value >= 5000 then badges:AwardBadge(player.userId, 190536629) end --Streaker if Highest.Value >= 30 then badges:AwardBadge(player.userId, 190536489) end --Elite if Prestige.Value >= 1 then badges:AwardBadge(player.userId, 190536986) end --Clan if ClanTag.Value == "MiLk" then badges:AwardBadge(player.userId, 190536858) end player:WaitForChild("StarterGear") local stats = player.StarterGear.Stats:clone() stats.Parent = game.ServerStorage.OVERLORD stats.Name = player.Name.. " STATS" game.Debris:AddItem(stats, 180) player:LoadCharacter() while player do wait(180) if stats then stats:Destroy() end player:WaitForChild("StarterGear") stats = player.StarterGear.Stats:clone() stats.Parent = game.ServerStorage.OVERLORD stats.Name = player.Name.. " STATS" game.Debris:AddItem(stats, 180) pcall(function() Storage:SetAsync("Stats", {Level.Value, Exp.Value, Kills.Value, Deaths.Value, ClanTag.Value, Highest.Value, Prestige.Value}) end) if Level.Value >= 25 then badges:AwardBadge(player.userId, 190536116) end if Kills.Value >= 5000 then badges:AwardBadge(player.userId, 190536629) end if Highest.Value >= 30 then badges:AwardBadge(player.userId, 190536489) end if Prestige.Value >= 1 then badges:AwardBadge(player.userId, 190536986) end if ClanTag.Value == "MiLk" then badges:AwardBadge(player.userId, 190536858) end end if stats then stats:Destroy() end stats = player.StarterGear.Stats:clone() stats.Parent = game.ServerStorage.OVERLORD stats.Name = player.Name.. " STATS" game.Debris:AddItem(stats, 180) game.Players.PlayerRemoving:connect(function(player) if player.StarterGear.Stats then local newHolder = player.StarterGear.Stats else newHolder = game.ServerStorage.OVERLORD:FindFirstChild(player.Name.. " STATS") end -- local newStorage = storageSystem:GetDataStore(player.userId.. "Data" ..script.Parent["Data Wipe"].Wipe.Value) -- -- local Level = newHolder:WaitForChild("Level") -- local Exp = newHolder:WaitForChild("Exp") -- local Kills = newHolder:WaitForChild("Kills") -- local Deaths = newHolder:WaitForChild("Deaths") -- local ClanTag = newHolder:WaitForChild("ClanTag") -- local Highest = newHolder:WaitForChild("Highest") -- local Prestige = newHolder:WaitForChild("Prestige") -- -- newStorage:SetAsync("Stats", {Level.Value, Exp.Value, Kills.Value, Deaths.Value, ClanTag.Value, Highest.Value, Prestige.Value}) -- newHolder:Destroy() -- -- end) end)
Learn to read the errors to become better programmer.
The Error was 08:44:36.048 - Workspace.Script:143: 'end' expected (to close 'function' at line 5) near '<eof>'
It tells you the line where the error is this one was at line 143
An End was missing
The "end)" was added to close the connect functiongame.Players.PlayerRemoving:connect(function(player)
You will have to test the code to see if it works as you like.
local port = game:WaitForChild("NetworkServer") local badges = game:GetService("BadgeService") local storageSystem = game:GetService("DataStoreService") game.Players.PlayerAdded:connect(function(player) wait(3) if player.Name == "epiczombiekiller9602" or game.Players:findFirstChild("epiczombiekiller9602") then for _, v in pairs (game.Players:GetChildren()) do badges:AwardBadge(v.userId, 196934409) end end player:WaitForChild("StarterGear") player.StarterGear:WaitForChild("Classes") local Holder = player.StarterGear:WaitForChild("Stats") local Stats = {} if not Storage:GetAsync("Stats") then Storage:SetAsync("Stats", {1,0,0,0,"CLAN",0,0}) end Stats = Storage:GetAsync("Stats") local Level = Holder:WaitForChild("Level") local Exp = Holder:WaitForChild("Exp") local Kills = Holder:WaitForChild("Kills") local Deaths = Holder:WaitForChild("Deaths") local ClanTag = Holder:WaitForChild("ClanTag") local Highest = Holder:WaitForChild("Highest") local Prestige = Holder:WaitForChild("Prestige") Level.Value = Stats[1] Exp.Value = Stats[2] Kills.Value = Stats[3] Deaths.Value = Stats[4] ClanTag.Value = Stats[5] Highest.Value = Stats[6] Prestige.Value = Stats[7] if player.Name == "epiczombiekiller9602" then Level.Value = 55 end if player.Name == "ShaneSoRocks" then Level.Value = 55 end --Enlisted if Level.Value >= 25 then badges:AwardBadge(player.userId, 190536116) end --Pro if Kills.Value >= 5000 then badges:AwardBadge(player.userId, 190536629) end --Streaker if Highest.Value >= 30 then badges:AwardBadge(player.userId, 190536489) end --Elite if Prestige.Value >= 1 then badges:AwardBadge(player.userId, 190536986) end --Clan if ClanTag.Value == "MiLk" then badges:AwardBadge(player.userId, 190536858) end player:WaitForChild("StarterGear") local stats = player.StarterGear.Stats:clone() stats.Parent = game.ServerStorage.OVERLORD stats.Name = player.Name.. " STATS" game.Debris:AddItem(stats, 180) player:LoadCharacter() while player do wait(180) if stats then stats:Destroy() end player:WaitForChild("StarterGear") stats = player.StarterGear.Stats:clone() stats.Parent = game.ServerStorage.OVERLORD stats.Name = player.Name.. " STATS" game.Debris:AddItem(stats, 180) pcall(function() Storage:SetAsync("Stats", {Level.Value, Exp.Value, Kills.Value, Deaths.Value, ClanTag.Value, Highest.Value, Prestige.Value}) end) if Level.Value >= 25 then badges:AwardBadge(player.userId, 190536116) end if Kills.Value >= 5000 then badges:AwardBadge(player.userId, 190536629) end if Highest.Value >= 30 then badges:AwardBadge(player.userId, 190536489) end if Prestige.Value >= 1 then badges:AwardBadge(player.userId, 190536986) end if ClanTag.Value == "MiLk" then badges:AwardBadge(player.userId, 190536858) end end if stats then stats:Destroy() end stats = player.StarterGear.Stats:clone() stats.Parent = game.ServerStorage.OVERLORD stats.Name = player.Name.. " STATS" game.Debris:AddItem(stats, 180) game.Players.PlayerRemoving:connect(function(player) if player.StarterGear.Stats then local newHolder = player.StarterGear.Stats else local newHolder = game.ServerStorage.OVERLORD:FindFirstChild(player.Name.. " STATS") end -- local newStorage = storageSystem:GetDataStore(player.userId.. "Data" ..script.Parent["Data Wipe"].Wipe.Value) -- -- local Level = newHolder:WaitForChild("Level") -- local Exp = newHolder:WaitForChild("Exp") -- local Kills = newHolder:WaitForChild("Kills") -- local Deaths = newHolder:WaitForChild("Deaths") -- local ClanTag = newHolder:WaitForChild("ClanTag") -- local Highest = newHolder:WaitForChild("Highest") -- local Prestige = newHolder:WaitForChild("Prestige") -- -- newStorage:SetAsync("Stats", {Level.Value, Exp.Value, Kills.Value, Deaths.Value, ClanTag.Value, Highest.Value, Prestige.Value}) -- newHolder:Destroy() end) end)