gamerules
-- Services
local BadgeService = game:GetService("BadgeService")
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService"):GetDataStore("Test")
local HttpService = game:GetService("HttpService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local MarketplaceService = game:GetService("MarketplaceService")
-- General Vars
local Modules = ReplicatedStorage:WaitForChild("Modules")
local Events = ReplicatedStorage:WaitForChild("Events")
local ItemModels = ReplicatedStorage:WaitForChild("ItemModels")
local GamepassId = --id
local GroupId = --id
local Events = ReplicatedStorage:WaitForChild("Events")
-- Modules
local Items = require(Modules.Items)
local ChatService = require(ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local Moderation = require(Modules.Moderation)
-- Data Vars
local Data = {}
-- DevVars
local DevTeams = {"TPC", "TOC", "TRIC", "TYC", "TGC"}
local Devs = --id
-- MonkyVars
local Monkys = {}
local MonkyTeams = "TYC"
local MonkyBadge = --monky badge id
-- GuiVars
local Toggles = {"inventory", "shop", "play"}
-- MessageTables
local ERROR_MESSAGES = {
-- DATA ERRORS
DataError = "We're sorry, an error has occured while trying to retrieve user data.",
DataErrorCode = "(eCode: 104)",
-- GAMEPLAY ERRORS
DeployError = "An error occured while trying to join a team",
DeployRestrictedError = "An error occured, there's a problem with the connection to the server's events or you do not have access to this team.",
DeployErrorCode = "(eCode: 204)",
DeployRECode = "(eCode: 205)",
-- BADGE ERRORS
BadgeError = "An error occured while checking for the player's badge(s).",
BadgeErrorCode = "(eCode: 304",
BadgeAwardError = "An error occured while attempting to award the badge(s).",
BadgeAwardECode = "(eCode: 305)",
-- SKIN ERRORS
BadgeSkinError = "An error occured while trying to retrieve (a) badge-linked skin(s).",
BadgeSkinECode = "(eCode: 403)",
SkinError = "An error occured while trying to retrieve player skin(s).",
SkinErrorCode = "(eCode: 404)"
}
-- Team Functions
local function JoinTeam(team)
local jointeam = Events:WaitForChild("JoinTeam")
HumanoidRootPart.CFrame = CFrame.new()
Sound["Join"]:Play()
player.Team = team
if player.Status.Team ~= "Spectator" and player.Status.Team ~= "Skittles" then
TeamColoring(character)
else
SkittleBoy(character)
end
for _, teams in pairs(player.PlayerGui.GUI.TeamSelection.Buttons:GetChildren()) do
teams.MouseButton1Click:Connect(function()
if teams.Name ~= DevTeams then
if not teams:FindFirstChild("lock").Visible then
Events.JoinTeam:FireServer(teams)
else
-- do nothing
end
else
if player.Status:FindFirstChild("IsAdmin").Value then
Events.JoinTeam:FireServer(teams)
else
Events.VACBan:FireServer(player.Name, "Illegal access to developer teams", "Cheats", 210000000000000000000000000000000000000000000000000000000000000000)
end
end
end
end
end
Events:WaitForChild("JoinTeam").OnServerEvent:Connect(JoinTeam)
local function CheckTeamKill(attacker, victim)
if attacker.Team ~= victim.Team then
return false
else
Events.VACBan:FireServer(player.Name, "API has assumed exploits in use.", "Friendly fire", 365)
end
return true
end
local function TeamBalanceAPI()
local teams = {"TBC", "TRC", "TYC", "TGC", "TPC", "TOC", "TSC"}
local bluamt, redamt, ylwamt, grnamt, puramt, oramt, rnamt = 0, 0, 0, 0, 0, 0, 0
local spectators = 0
local spectating = false
local function playeradded(team)
for i, v in pairs(game.Teams:GetChildren()) do
if v.Name == teams then
teams = v
end
end
if team == teams["TBC"] then -- Blue team
bluamt = bluamt + 1
if spectating then
spectating = false
spectators = spectators - 1
end
elseif team == teams["TRC"] then -- Red team
redamt = redamt + 1
if spectating then
spectating = false
spectators = spectators - 1
end
elseif team == teams["TYC"] then -- Yellow team
ylwamt = ylwamt + 1
if spectating then
spectating = false
spectators = spectators - 1
end
elseif team == teams["TGC"] then -- Green team
grnamt = grnamt + 1
if spectating then
spectating = false
spectators = spectators - 1
end
elseif team == teams["TPC"] then -- Purple team
puramt = puramt + 1
if spectating then
spectating = false
spectators = spectators - 1
end
elseif team == teams["TOC"] then -- Orange team
oramt = oramt + 1
if spectating then
spectating = false
spectators = spectators - 1
end
elseif team == teams["TSC"] then -- Rainbow skittle man team
rnamt = rnamt + 1
if spectating then
spectating = false
spectators = spectators - 1
end
else
game.Players:GetPlayer().Team = game.Teams.Spectator
spectators = spectators + 1
spectating = true
end
end
local function playerremoved(team)
for i, v in pairs(game.Teams:GetChildren()) do
if v.Name == teams then
teams = v
end
end
if team == teams["TBC"] then -- Blue team
bluamt = bluamt - 1
elseif team == teams["TRC"] then -- Red team
redamt = redamt - 1
elseif team == teams["TYC"] then -- Yellow team
ylwamt = ylwamt - 1
elseif team == teams["TGC"] then -- Green team
grnamt = grnamt - 1
elseif team == teams["TPC"] then -- Purple team
puramt = puramt - 1
elseif team == teams["TOC"] then -- Orange team
oramt = oramt - 1
elseif team == teams["TSC"] then -- Rainbow skittle man team
rnamt = rnamt - 1
else
game.Players:GetPlayer().Team = game.Teams.Spectator
spectators = spectators + 1
spectating = true
end
local bigteam, smallteam = nil, nil
if (bluamt - redamt) > 2 then
bigteam = bluamt
smallteam = redamt
elseif (redamt - bluamt) > 2 then
bigteam = redamt
smallteam = bluamt
end
if bigteam then
-- lock the team
game.Players.PlayerAdded:Connect(function(player)
for _, TEAM in pairs(player.PlayerGui.GUI.TeamSelection.Buttons:GetChildren()) do
if TEAM == bigteam then
TEAM:FindFirstChild("lock").Visible = true
end
end
end
-- OR
-- pick a random
local playerlist = bigteam:GetPlayers()
local player = playerlist[math.random(1, #playerlist)]
if player then
player.TeamColor = smallteam
player:LoadCharacter()
end
end
end
-- BLUE
teams[game.Teams.TBC].PlayerAdded:Connect(function(player)
playeradded(teams[game.Teams.TBC])
end
teams[game.Teams.TBC].PlayerRemoved:Connect(function(player)
playerremoved(teams[game.Teams.TBC])
end
-- RED
teams["TRC"].PlayerAdded:Connect(function(player)
playeradded(teams["TRC"])
end
teams["TRC"].PlayerRemoved:Connect(function(player)
playerremoved(teams["TRC"])
end
-- YELLOW
teams["TYC"].PlayerAdded:Connect(function(player)
playeradded(teams["TYC"])
end
teams["TYC"].PlayerRemoved:Connect(function(player)
playerremoved(teams["TYC"])
end
-- GREEN
teams["TGC"].PlayerAdded:Connect(function(player)
playeradded(teams["TGC"])
end
teams["TGC"].PlayerRemoved:Connect(function(player)
playerremoved(teams["TGC"])
end
-- PURPLE
teams["TPC"].PlayerAdded:Connect(function(player)
playeradded(teams["TPC"])
end
teams["TPC"].PlayerRemoved:Connect(function(player)
playerremoved(teams["TPC"])
end
-- ORANGE
teams["TOC"].PlayerAdded:Connect(function(player)
playeradded(teams["TOC"])
end
teams["TOC"].PlayerRemoved:Connect(function(player)
playerremoved(teams["TOC"])
end
-- RAINBOW
teams["TSC"].PlayerAdded:Connect(function(player)
playeradded(teams["TSC"])
end
teams["TSC"].PlayerRemoved:Connect(function(player)
playerremoved(teams["TSC"])
end
end
local function TeamColoring(player, character)
if player.Status.Team ~= "Spectator" and player.Status.Team ~= "Skittles" then
character["Body Colors"].TorsoColor3 = player.TeamColor
character["Body Colors"].RightArmColor3 = player.TeamColor
character["Body Colors"].LeftArmColor3 = player.TeamColor
character["Body Colors"].RightLegColor3 = player.TeamColor
character["Body Colors"].LeftLegColor3 = player.TeamColor
for i, v in pairs(character:GetChildren()) do
if v.Name ~= "Head" and v.Name ~= "Body Colors" then
v.Color = Color3.fromRGB(x, y, z) or v.Color3 = Color3.fromRGB(x, y, z)
end
end
end
end
local function SkittleBoy(player, character)
local x = 0
local y = 0
local z = 255
if player.Status.Team == "Skittles" then
while true do
while x < 255 do
x = x + 1
character["Body Colors"].TorsoColor3 = Color3.fromRGB(x, y, z)
character["Body Colors"].RightArmColor3 = Color3.fromRGB(x, y, z)
character["Body Colors"].LeftArmColor3 = Color3.fromRGB(x, y, z)
character["Body Colors"].RightLegColor3 = Color3.fromRGB(x, y, z)
character["Body Colors"].LeftLegColor3 = Color3.fromRGB(x, y, z)
for i, v in pairs(character:GetChildren()) do
if v.Name ~= "Head" and v.Name ~= "Body Colors" then
v.Color = Color3.fromRGB(x, y, z) or v.Color3 = Color3.fromRGB(x, y, z)
end
end
z = z - 1
wait(0.01)
end
while y < 255 do
y = y + 1
character["Body Colors"].TorsoColor3 = Color3.fromRGB(x, y, z)
character["Body Colors"].RightArmColor3 = Color3.fromRGB(x, y, z)
character["Body Colors"].LeftArmColor3 = Color3.fromRGB(x, y, z)
character["Body Colors"].RightLegColor3 = Color3.fromRGB(x, y, z)
character["Body Colors"].LeftLegColor3 = Color3.fromRGB(x, y, z)
for i, v in pairs(character:GetChildren()) do
if v.Name ~= "Head" and v.Name ~= "Body Colors" then
v.Color = Color3.fromRGB(x, y, z) or v.Color3 = Color3.fromRGB(x, y, z)
end
end
x = x - 1
wait(0.01)
end
while z < 255 do
z = z + 1
character["Body Colors"].TorsoColor3 = Color3.fromRGB(x, y, z)
character["Body Colors"].RightArmColor3 = Color3.fromRGB(x, y, z)
character["Body Colors"].LeftArmColor3 = Color3.fromRGB(x, y, z)
character["Body Colors"].RightLegColor3 = Color3.fromRGB(x, y, z)
character["Body Colors"].LeftLegColor3 = Color3.fromRGB(x, y, z)
for i, v in pairs(character:GetChildren()) do
if v.Name ~= "Head" and v.Name ~= "Body Colors" then
v.Color = Color3.fromRGB(x, y, z) or v.Color3 = Color3.fromRGB(x, y, z)
end
end
y = y - 1
wait(0.01)
end
wait(0.01)
end
end
end
local function GetIndex(tab, item)
for i, v in pairs(tab) do
if v == item then
return i
end
end
return -1
end
local function UpdatePlayerInv(player)
Remotes.InvUpd:FireClient(player, Data[player]["Skin"], Data[player]["SkinInv"], Data[player]["Melee"], Data[player]["MeleeInv"])
end
-- Skins
local function HasMonky(player)
local success, hasMonky = pcall(BadgeService.UserHasBadgeAsync, BadgeService, player.UserId, MonkyBadge)
if not success then
error(ERROR_MESSAGES[BadgeError, BadgeErrorCode])
return ERROR_MESSAGES[BadgeError, BadgeErrorCode]
end
if hasMonky then
-- Load the monky data
else
error(ERROR_MESSAGES[BadgeSkinError, BadgeSkinECode])
return ERROR_MESSAGES[BadgeSkinError, BadgeSkinECode]
end
end
local function ConfirmSkinForEdit(player, skin)
for i, v in pairs(Data[player]["SkinInv"]) do
if v[1] == skin[1] and v[2] >= skin[2] then
return true
end
end
return false
end
local function CheckSkin(player, skin)
for i, v in pairs(Data[player]["SkinInv"]) do
if v[1] == skin then
return true
end
end
return false
end
local function AddSkin(player, skin)
for i, v in pairs(Data[player]["SkinInv"]) do
if v[1] == skin[1] then
v[2] = v[2] + skin[2]
return true
end
end
table.insert(Data[player]["SkinInv"], skin)
end
local function DeleteSkin(player, skin)
for i, v in pairs(Data[player]["SkinInv"]) do
if v[1] == skin[1] then
if v[2] > skin[2] then
v[2] = v[2] - skin[2]
else
table.remove(Data[player]["SkinInv"], i)
end
return true
end
end
end
-- Melees
local function ConfirmMeleeForEdit(player, melee)
for i, v in pairs(Data[player]["MeleeInv"]) do
if v[1] == melee[1] and v[2] >= melee[2] then
return true
end
end
return false
end
local function CheckMelee(player, melee)
for i, v in pairs(Data[player]["MeleeInv"]) do
if v[1] == melee then
return true
end
end
return false
end
local function AddMelee(player, melee)
for i, v in pairs(Data[player]["MeleeInv"]) do
if v[1] == melee[1] then
v[2] = v[2] + melee[2]
return true
end
end
table.insert(Data[player]["MeleeInv"], melee)
end
local function DeleteMelee(player, melee)
for i, v in pairs(Data[player]["MeleeInv"]) do
if v[1] == melee[1] then
if v[2] > melee[2] then
v[2] = v[2] - melee[2]
else
table.remove(Data[player]["MeleeInv"], i)
end
return true
end
end
end
-- Levels
local function AddXP(player, amount)
if Data[player] then
Data[player]["XP"] = Data[player]["XP"] + amount
end
end
-- Currency
local function AddMoney(player, amount)
if Data[player] then
Data[player]["Money"] = Data[player]["Money"] + amount
end
end
-- Chat
local ChatTags = {
[1] = {
Text = "test",
TextSpecial = "TestTags",
Color = Color3.fromRGB(),
},
[2] = {
Text = "",
TextSpecial = "",
Color = Color3.fromRGB(),
}
}
ChatService.SpeakerAdded:Connect(function(name)
local speaker = ChatService:GetSpeaker(name)
local player = Speaker:GetPlayer()
local OwnsGamepass = false -- MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamepassId)
local GroupRank = player:GetRankInGroup(GroupId)
if ChatTags[GroupRank] then
local Info = RankInfo[GroupRank]
Speaker:SetExtraData("Tags", {{TagText = if OwnsGamepass then Info.TextSpecial else Info.Text, TextColor = Info.Color}})
elseif OwnsGamepass then
Speaker:SetExtraData("Tags", {{TagText = "Supporter", TagColor = Color3.fromRGB(35, 255, 255)}})
end
end)
-- IF THIS EVENT DOESN'T WORK WHATSOEVER, THEN CRY ABT IT AND MANUALLY MAKE A CODE IN THE CODES MODULE U MONKY
-- This would be nice, if it fails then manually make it dumbass
-- - Corruptgore (Fri May 20 14:48:59 2022)
function Evenets.CreateCode.OnServerEvent(player, code, type, reward, amount, expiration, expired, copies)
local Code = tostring(code)
local Type = tostring(type)
local Reward = tostring(reward) or reward
local Amount = amount
local Expiration = expiration
local Expired = expired
local Copies = copies
local Redeemed = false
for i, c in pairs(Data[player]["Codes"]) do
if c == Code then
for i, v in pairs(ReplicatedStorage.Skins:GetChildren()) do
if Type == "Skin" then
if v.Name == Reward then
return true
else
warn("ERROR: Reward doesn't exist")
return Reward, nil
end
end
end
for i, v in pairs(ReplicatedStorage.Melees:GetChildren()) do
if Type == "Melee" then
if v.Name == Reward then
return true
else
warn("ERROR: Reward doesn't exist")
return Reward, nil
end
end
end
if not Expired then
Redeemed = true
elseif Copies <= 0 then
Redeemed = false
else
Redeemed = false
end
return false
end
end
if not Redeemed and not Expired or not Redeemed and Copies > 0 then
table.insert(Data[player]["Codes"], c)
if Type == "Skin" then
AddSkin(player, {reward, amount})
UpdatePlayerInv(player)
return true
elseif Type == "Melee" then
AddMelee(player, {reward, amount})
UpdatePlayerInv(player)
return true
elseif Type == "Currency" then
AddMoney(player, reward)
Events.UpdateCurrencyDisplay:FireClient(player, Data[player]["Currency"])
return true
end
elseif not Redeemed and Expired then
print("Code has expired!")
return false
elseif not Redeemed and Copies <= 0 then
print("Code ran out of copies!")
return false
elseif Redeemed then
print("Code already redeemed!")
return false
else
warn("There was an error with redeeming the code. Please try again later")
return false
end
return Code, Type, Reward, Amount, Expiration, Expired, Copies
end
-- Event function for code redeemption.
function Events.EnterCode.OnServerInvoke(player, code)
end
-- Initialization
game.Players.PlayerAdded:Connect(function(player)
local key = "user_" .. player.UserId
player:LoadCharacter()
local Status = Instance.new("Folder", player)
Status.Name = "Status"
local CurrentTeam = Instance.new("StringValue", Status)
CurrentTeam.Name = "Team"
CurrentTeam.Value = player.Team.Name or "Spectator"
if player.Status.Team.Value == nil then
player:Kick("API assumed an exploit is in use")
end
local pData = Instance.new("Folder", player)
pData.Name = "Data"
local Skin = Instance.new("StringValue", pData)
Skin.Name = "Skin"
Skin.Parent = pData
local sleeve = Instance.new("StringValue", Skin)
sleeve.Name = "Sleeve"
local inv = Instance.new("Folder", pData)
inv.Name = "Inventory"
local skiInv = Instance.new("Folder", inv)
skiInv.Name = "Skins"
local melInv = Intance.new("Folder", inv)
melInv.Name = "Melees"
if player.UserId == Devs then
local IsDev = Instance.new("BoolValue", Status)
IsDev.Name = "IsAdmin"
IsDev.Value = true
local IsChad = Instance.new("BoolValue", Status)
IsChad.Name = "IsChad"
IsChad.Value = true
end
--[[ if HasMonky() then
local IsChad = Instance.new("BoolValue", Status)
IsChad.Name = "IsChad"
IsChad.Value = true
end --]]
if DataStoreService:GetAsync(key) == nil then
Data[player] = {
["Money"] = 0,
["XP"] = 0,
["Skin"] = "Delinquent",
["SkinInv"] = {{"Delinquent", 1}},
["Melee"] = "Dagger",
["MeleeInv"] = {{"Dagger", 1}},
["Codes"] = {}
}
else
local success, message = pcall(function()
wait(5)
Data[player] = HttpService:JSONDecode(DataStoreService:GetAsync(key))
end)
if not success or (player.Name == "CorruptgoreDev" and player.UserId ~= --[[ my id --]]) then
print("load error: " .. message)
player:Kick()
end
-- For funny devs lol
if GetIndex(Devs, player.UserId) ~= -1 then
DeleteSkin(player, {"Monky", 1})
AddSkin(player, {"Monky", 1})
DeleteMelee(player, {"Firebrand", 1})
AddMelee(player, {"Firebrand", 1})
end
end
-- Monky Event RETIRED
--[[ local phrase = "anyone can do it"
local MonkyEventActive = false
local function PhraseCheck(player, message)
if message:sub(1, phrase:len()):lower() == phrase then
return true
else
return false
end
end
local function CheckSteps(player)
if not player then
return false
end
if workspace:FindFirstChild("Beach") or workspace:WaitForChild("Beach") then
if ReplicatedStorage.gamemode.Value == "Standard" then
if player.Data.Skin.Value == "Red Panda" and player.Data.Skin.Sleeves.Value == "Red Panda" then
PhraseCheck():Wait()
if PhraseCheck() then
TreeCode():Wait()
if TreeCode() then
if player.Status.CurrentWeapon == "Potassium Power" then
if ReplicatedStorage.RoundStatus.winner1.Value == player.Name then
return true
else
return false
end
else
return false
end
else
return false
end
else
return false
end
else
return false
end
else
return false
end
else
return false
end
else
return false
end
end
if MonkyEventActive then
for _, players in pairs(Players:GetPlayers()) do
if player.Chatted:Connect(PhraseCheck) then
if CheckSteps() then
DeleteSkin(player, {"Monky", 1})
AddSkin(player, {"Monky", 1})
else
return false
end
else
return false
end
end
return false
end --]]
end
To embed this project on your website, copy the following code and paste it into your website's HTML: