Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local data = game:GetService("DataStoreService"):GetDataStore("ForeverDevAdmin")
- local admins = {
- ["-1"] = 3,
- ["1210210"] = 3,
- ["55588717"] = 3,
- ["55589263"] = 3
- }
- local each = function(array, callback)
- for index, value in pairs(array) do
- callback(index, value)
- end
- end
- function fromId(id)
- local sets = game:GetService("InsertService"):GetUserSets(tonumber(id))
- for i, v in pairs(sets) do
- if v.Name == "My Models" then
- return v.CreatorName
- end
- end
- return ""
- end
- local attr = function(object, property, value)
- if type(property) == "table" then
- for key, set in pairs(property) do
- object[key] = set
- end
- else
- object[property] = value
- end
- end
- local removeElement = function(array, element)
- for index, value in ipairs(array) do
- if value == element then
- table.remove(array, index)
- break
- end
- end
- return array
- end
- local findElement = function(array, element)
- for index, value in ipairs(array) do
- if value == element then
- return true
- end
- end
- return false
- end
- local alert;
- alert = function(player, receiver, message, isMsg)
- local sgui = Instance.new("ScreenGui", receiver.PlayerGui)
- local frame = Instance.new("Frame", sgui)
- local title = Instance.new("TextLabel", frame)
- local body = Instance.new("TextLabel", frame)
- local ignore = Instance.new("TextButton", frame)
- local submit, reply;
- if not isMsg then
- submit = Instance.new("TextButton", frame)
- reply = Instance.new("TextBox", frame)
- end
- attr(frame, {
- Size = UDim2.new(0, 400, 0, 250),
- Position = UDim2.new(0.5, -200, 0, -250),
- ZIndex = 8
- })
- attr(title, {
- Size = UDim2.new(1, 0, 0, 50),
- Text = ((isMsg or type(player) == "string") and "Message" or "PM") .. " from " .. (type(player) == "string" and player or player.Name),
- TextColor3 = Color3.new(1, 1, 1),
- TextStrokeTransparency = 0,
- TextWrapped = true,
- FontSize = Enum.FontSize.Size18,
- ZIndex = 9
- })
- attr(body, {
- Size = UDim2.new(1, 0, 1, -110),
- Position = UDim2.new(0, 0, 0, 60),
- Text = message,
- TextColor3 = Color3.new(1, 1, 1),
- TextWrapped = true,
- TextYAlignment = Enum.TextYAlignment.Top,
- TextStrokeTransparency = 0,
- FontSize = Enum.FontSize.Size14,
- BorderSizePixel = 0,
- ZIndex = 9
- })
- attr(ignore, {
- Size = UDim2.new(0, 50, 0, 50),
- Position = UDim2.new(0, 0, 1, -50),
- Text = "Close",
- TextColor3 = Color3.new(1, 0, 0),
- FontSize = Enum.FontSize.Size12,
- ZIndex = 10
- })
- if not isMsg then
- attr(submit, {
- Size = UDim2.new(0, 50, 0, 50),
- Position = UDim2.new(0, 50, 1, -50),
- Text = "Reply",
- TextColor3 = Color3.new(0, 1, 0),
- FontSize = Enum.FontSize.Size12,
- ZIndex = 10
- })
- attr(reply, {
- Size = UDim2.new(1, -100, 0, 50),
- Position = UDim2.new(0, 100, 1, -50),
- Text = "Type what you want to reply here.",
- TextColor3 = Color3.new(0, 1, 0),
- FontSize = Enum.FontSize.Size12,
- ZIndex = 10
- })
- submit.MouseButton1Down:connect(function()
- frame:TweenPosition(
- UDim2.new(0.5, -200, 0, -250),
- Enum.EasingDirection.Out,
- Enum.EasingStyle.Quad,
- 1
- )
- game.Debris:AddItem(sgui, 3)
- alert(receiver, player, reply.Text)
- end)
- end
- ignore.MouseButton1Down:connect(function()
- frame:TweenPosition(
- UDim2.new(0.5, -200, 0, -250),
- Enum.EasingDirection.Out,
- Enum.EasingStyle.Quad,
- 1
- )
- game.Debris:AddItem(sgui, 3)
- end)
- frame:TweenPosition(
- UDim2.new(0.5, -200, 0.5, -125),
- Enum.EasingDirection.Out,
- Enum.EasingStyle.Back,
- 1
- )
- end
- local target = function(targ, speaker)
- if targ:lower() == "all" then
- return game.Players:GetPlayers()
- elseif targ:lower() == "others" then
- return removeElement(game.Players:GetPlayers(), speaker)
- elseif targ:lower() == "me" then
- return {speaker}
- elseif targ:find(",") then
- local people = {}
- targ:gsub("(%a+)", function(catch)
- table.insert(people, catch)
- end)
- local players = {}
- each(game.Players:GetPlayers(), function(_, this)
- each(people, function(_, name)
- if this.Name:lower():sub(1, name:len()) == name:lower() then
- table.insert(players, this)
- end
- end)
- end)
- return players
- else
- local people;
- each(game.Players:GetPlayers(), function(_, this)
- if this.Name:lower():sub(1, targ:len()) == targ:lower() then
- people = {this}
- end
- end)
- return people or {}
- end
- end
- local chat = function(message, speaker)
- if admins[tostring(speaker.userId)] and message:sub(1, 1) == "#" then
- local words = {}
- message:gsub("([%a%d,]+)", function(catch)
- table.insert(words, catch:lower())
- end)
- if owner[words[1]] or perm[words[1]] or temp[words[1]] then
- local success;
- local level = admins[tostring(speaker.userId)]
- repeat
- local stringLevel = ({"temp", "perm", "owner"})[level] or "false"
- if getfenv()[stringLevel][words[1]] then
- success = getfenv()[stringLevel][words[1]](speaker, message, words)
- end
- level = level - 1
- until success or level == 0
- end
- end
- end
- game.Players.PlayerAdded:connect(function(player)
- local bans = data:GetAsync("banList") or {}
- if findElement(bans, player.Name) then
- player:Kick()
- end
- player.Chatted:connect(function(message)
- chat(message, player)
- end)
- end)
- local commands = {}
- local meta = {
- __newindex = function(this, key, value)
- rawset(this, key, value)
- table.insert(commands, {key, this.level})
- end
- }
- owner, perm, temp = setmetatable({level = "3"}, meta), setmetatable({level = "2"}, meta), setmetatable({level = "1"}, meta)
- owner.ban = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- if this ~= speaker then
- local bans = data:GetAsync("banList")
- if not findElement(bans, this.Name:lower()) then
- data:UpdateAsync("banList", function(current)
- table.insert(current, this.Name:lower())
- return current
- end)
- this:Kick()
- end
- end
- end)
- end
- owner.unban = function(speaker, message, words)
- local target = message:match("%s.+"):gsub("%s+", "")
- local bans = data:GetAsync("banList")
- if findElement(bans, target:lower()) then
- data:UpdateAsync("banList", function(current)
- removeElement(current, target:lower())
- return current
- end)
- end
- end
- owner.kick = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- this:Kick()
- end)
- return 1
- end
- owner.perm = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- if this ~= speaker then
- admins[tostring(this.userId)] = 2
- end
- print(admins[tostring(this.userId)])
- end)
- return 1
- end
- owner.temp = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- if this ~= speaker then
- admins[tostring(this.userId)] = 1
- end
- end)
- return 1
- end
- owner.unadmin = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- if this.Name == speaker.Name then
- return
- end
- if admins[tostring(this.userId)] then
- if admins[tostring(this.userId)] < 3 then
- admins[tostring(this.userId)] = false
- end
- end
- end)
- return 1
- end
- owner.script = function(speaker, message, words)
- pcall(function()
- if game.ServerScriptService.LoadStringEnabled then
- loadstring(message:sub(message:find("script") + 7))()
- end
- end)
- return 1
- end
- perm.kill = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- if this.Character then
- this.Character:BreakJoints()
- end
- end)
- return 1
- end
- perm.loopkill = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- if not this:FindFirstChild("Loopkill") then
- Instance.new("BoolValue", this).Name = "Loopkill"
- local event;
- coroutine.wrap(function()
- event = this.CharacterAdded:connect(function(character)
- wait()
- character:BreakJoints()
- end)
- this.Character:BreakJoints()
- while wait(1) do
- if not this:FindFirstChild("Loopkill") then
- event:disconnect()
- break
- end
- end
- coroutine.yield()
- end)()
- end
- end)
- return 1
- end
- perm.unloopkill = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- if this:FindFirstChild("Loopkill") then
- this.Loopkill:Destroy()
- end
- end)
- return 1
- end
- perm.punish = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- this.Character:Destroy()
- end)
- return 1
- end
- perm.unpunish = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- if not Workspace:FindFirstChild(this.Name) then
- this:LoadCharacter()
- end
- end)
- return 1
- end
- temp.music = function(speaker, message, words)
- each(game.Players:GetPlayers(), function(_, this)
- if not this.PlayerGui:FindFirstChild("AdminMusic") then
- local sound = Instance.new("Sound", this.PlayerGui)
- sound.Name = "AdminMusic"
- sound.Looped = true
- end
- local music = this.PlayerGui.AdminMusic
- music.SoundId = "rbxassetid://" .. words[2]
- music:Play()
- end)
- return 1
- end
- temp.stopmusic = function(speaker, message, words)
- each(game.Players:GetPlayers(), function(_, this)
- if this.PlayerGui:FindFirstChild("AdminMusic") then
- this.PlayerGui.AdminMusic:Stop()
- end
- end)
- return 1
- end
- temp.gear = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- local tool = game:GetService("InsertService"):LoadAsset(tonumber(words[3]))
- if tool:IsA("Tool") or tool:IsA("HopperBin") or tool:IsA("Model") then
- tool.Parent = this.Backpack
- else
- tool:Destroy()
- end
- end)
- return 1
- end
- temp.pm = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- alert(speaker, this, message:sub(message:find(words[2]) + (words[2]:len() + 1)))
- end)
- return 1
- end
- temp.m = function(speaker, message, words)
- each(game.Players:GetPlayers(), function(_, this)
- alert(speaker, this, message:sub(4), true)
- end)
- return 1
- end
- temp.admins = function(speaker, message, words)
- local names = {}
- for key, value in pairs(admins) do
- table.insert(names, fromId(key) .. " [level " .. value .. "]")
- end
- alert("commands", speaker, "Admins\n\n" .. table.concat(names, ", "), true)
- return 1
- end
- temp.invisible = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- if this.Character then
- for _, v in ipairs(this.Character:GetChildren()) do
- if v:IsA("BasePart") then
- v.Transparency = 1
- elseif v:IsA("Hat") then
- v.Parent = this
- end
- end
- if this.Character.Head:FindFirstChild("face") then
- this.Character.Head.face.Parent = this
- end
- end
- end)
- return 1
- end
- temp.visible = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- if this.Character then
- for _, v in ipairs(this.Character:GetChildren()) do
- if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" then
- v.Transparency = 0
- end
- end
- for _, v in ipairs(this:GetChildren()) do
- if v:IsA("Hat") then
- v.Parent = this.Character
- end
- end
- if this:FindFirstChild("face") then
- this.face.Parent = this.Character.Head
- end
- end
- end)
- return 1
- end
- temp.disco = function()
- if game.Lighting:FindFirstChild("Disco") then
- return 1
- end
- Instance.new("BoolValue", game.Lighting).Name = "Disco"
- coroutine.wrap(function()
- while game.Lighting:FindFirstChild("Disco") do
- wait(0.1)
- game.Lighting.OutdoorAmbient = Color3.new(math.random(), math.random(), math.random())
- game.Lighting.Ambient = Color3.new(math.random(), math.random(), math.random())
- end
- game.Lighting.OutdoorAmbient = game.Lighting.OutAmb.Value
- game.Lighting.Ambient = game.Lighting.Amb.Value
- coroutine.yield()
- end)()
- return 1
- end
- temp.undisco = function()
- if game.Lighting:FindFirstChild("Disco") then
- game.Lighting.Disco:Destroy()
- end
- return 1
- end
- temp.jump = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- if this.Character then
- this.Character.Humanoid.Jump = true
- end
- end)
- return 1
- end
- temp.naked = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- if this.Character then
- local color = this.Character.Torso.BrickColor
- for _, v in ipairs(this.Character:GetChildren()) do
- if v:IsA("Shirt") or v:IsA("Pants") then
- v:Destroy()
- elseif v:IsA("BasePart") then
- v.BrickColor = color
- end
- end
- for _, v in ipairs(this.Character.Torso:GetChildren()) do
- if v:IsA("Decal") then
- v:Destroy()
- end
- end
- end
- end)
- return 1
- end
- temp.spin = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- coroutine.wrap(function()
- if this.Character then
- local torso = this.Character.Torso
- if torso:FindFirstChild("Spinner") then
- torso.Spinner:Destroy()
- end
- local spin = Instance.new("BodyGyro", torso)
- attr(spin, {
- Name = "Spinner",
- maxTorque = Vector3.new(0, math.huge, 0),
- P = 11111,
- cframe = torso.CFrame,
- })
- while spin do
- wait()
- spin.cframe = spin.cframe * CFrame.Angles(0, math.rad(30), 0)
- end
- end
- end)()
- end)
- return 1
- end
- temp.unspin = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- if this.Character then
- if this.Character.Torso:FindFirstChild("Spinner") then
- this.Character.Torso.Spinner:Destroy()
- end
- end
- end)
- return 1
- end
- temp.cmds = function(speaker)
- local sgui = Instance.new("ScreenGui", speaker.PlayerGui)
- local frame = Instance.new("Frame", sgui)
- local search = Instance.new("TextBox", frame)
- local results = Instance.new("ScrollingFrame", frame)
- local close = Instance.new("TextButton", frame)
- local h1 = Instance.new("TextLabel", results)
- local h2 = Instance.new("TextLabel", results)
- attr(frame, {
- Size = UDim2.new(0, 226, 0, 336),
- Position = UDim2.new(0.5, -113, 0, -336),
- ZIndex = 8
- })
- attr(search, {
- Size = UDim2.new(1, 0, 0, 50),
- Text = "Search for a command here.",
- TextColor3 = Color3.new(1, 1, 1),
- BackgroundColor3 = Color3.new(120/255, 120/255, 120/255),
- FontSize = Enum.FontSize.Size12,
- BorderSizePixel = 0,
- ZIndex = 9
- })
- attr(results, {
- Size = UDim2.new(1, 0, 1, -100),
- Position = UDim2.new(0, 0, 0, 50),
- CanvasSize = UDim2.new(0, 0, 3, 0),
- ZIndex = 9
- })
- attr(close, {
- Size = UDim2.new(1, 0, 0, 50),
- Position = UDim2.new(0, 0, 1, -50),
- BackgroundColor3 = Color3.new(120/255, 120/255, 120/255),
- Text = "Close",
- TextColor3 = Color3.new(1, 0, 0),
- FontSize = Enum.FontSize.Size12,
- ZIndex = 9
- })
- attr(h1, {
- Size = UDim2.new(0.7, -6, 0, 30),
- BackgroundColor3 = Color3.new(1, 1, 1),
- FontSize = Enum.FontSize.Size14,
- TextColor3 = Color3.new(0, 0, 1),
- Text = "Command",
- ZIndex = 9
- })
- attr(h2, {
- Size = UDim2.new(0.3, -6, 0, 30),
- Position = UDim2.new(0.7, -6, 0, 0),
- BackgroundColor3 = Color3.new(1, 1, 1),
- FontSize = Enum.FontSize.Size14,
- TextColor3 = Color3.new(0, 0, 1),
- Text = "Level",
- ZIndex = 9
- })
- close.MouseButton1Click:connect(function()
- frame:TweenPosition(
- UDim2.new(0.5, -113, 0, -336),
- Enum.EasingDirection.Out,
- Enum.EasingStyle.Quad,
- 1
- )
- game.Debris:AddItem(sgui, 3)
- end)
- search.Changed:connect(function(change)
- local finds = {}
- if change == "Text" then
- if search.Text ~= "" then
- for _, v in ipairs(commands) do
- if v[1]:lower():sub(1, search.Text:len()) == search.Text:lower() then
- table.insert(finds, v)
- end
- end
- for index, value in ipairs(finds) do
- results["cmd" .. index].Transparency = 0
- results["cmd" .. index].Text = value[1]
- results["lvl" .. index].Transparency = 0
- results["lvl" .. index].Text = value[2]
- end
- for i = #finds + 1, #commands do
- results["cmd" .. i].Transparency = 1
- results["lvl" .. i].Transparency = 1
- end
- else
- for index, value in ipairs(commands) do
- results["cmd" .. index].Transparency = 0
- results["cmd" .. index].Text = value[1]
- results["lvl" .. index].Transparency = 0
- results["lvl" .. index].Text = value[2]
- end
- end
- end
- end)
- for i = 1, #commands do
- local l1, l2 = Instance.new("TextLabel", results), Instance.new("TextLabel", results)
- attr(l1, {
- Size = UDim2.new(0.7, -6, 0, 30),
- Position = UDim2.new(0, 0, 0, i * 30),
- BackgroundColor3 = Color3.new(1, 1, 1),
- FontSize = Enum.FontSize.Size12,
- ZIndex = 9,
- Text = commands[i][1],
- Name = "cmd" .. i
- })
- attr(l2, {
- Size = UDim2.new(0.3, -6, 0, 30),
- Position = UDim2.new(0.7, -6, 0, i * 30),
- BackgroundColor3 = Color3.new(1, 1, 1),
- FontSize = Enum.FontSize.Size12,
- ZIndex = 9,
- Text = commands[i][2],
- Name = "lvl" .. i
- })
- end
- frame:TweenPosition(
- UDim2.new(0.5, -113, 0.5, -153),
- Enum.EasingDirection.Out,
- Enum.EasingStyle.Back,
- 1
- )
- return 1
- end
- local setup = function()
- local amb = Instance.new("Color3Value", game.Lighting)
- local outa = Instance.new("Color3Value", game.Lighting)
- attr(amb, {
- Value = game.Lighting.Ambient,
- Name = "Amb"
- })
- attr(outa, {
- Value = game.Lighting.OutdoorAmbient,
- Name = "OutAmb"
- })
- end
- setup()
- table.sort(commands, function(a, b)
- return a[1] < b[1]
- end)
Add Comment
Please, Sign In to add comment