Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[CLOSED] [FIXED] Making an Admin, Not Running PlayerAdded or Chatted Function?

Asked by 6 years ago
Edited 6 years ago

Hi there, I would like someone's help to find out why the:

game.Players.PlayerAdded:Connect(function(plr)

method and:

plr.Chatted:Connect(function(message)

are not working.

Here is the scripts that are connected and run:

Admin Main

                                                                                                --[[
_____________________________________________________________________________________________


                                    \    / |\    /|
                                     \  /  | \  / |
                                      \/   |  \/  |
                                      /\   |      |
                                     /  \  |      | /\
                                    /    \ |      | \/

                                    ------------------
                                     Things Made Easy
                                    ------------------

                              XMAdmin Writen By Marineboy308



Copyright© 2018 - 2019 [ Terms And Conditions Apply ]

For More Info,
Visit: https://www.copyrightservice.co.uk/copyright/

_____________________________________________________________________________________________
                                                                                                --]]

local settings = require(game:GetService("ServerScriptService").XMAdmin.Settings)
local dataStoreModule = require(script.Parent.Settings.DataStore)

warn("[XMAdmin]: Thank you for using XMAdmin!")
warn("[XMAdmin]: Initializing Settings...")

dataStore = settings.DataBase
dataKey = settings.DataBaseKey
storage = settings.SystemStorage

data = game:GetService("DataStoreService"):GetDataStore(dataStore)

mods = data:GetAsync(dataKey.."-Mods")
wait(0.166666667)
admins = data:GetAsync(dataKey.."-Admins")
wait(0.166666667)
CO_admins = data:GetAsync(dataKey.."-COadmins")
wait(0.166666667)
COA_admins = data:GetAsync(dataKey.."-COAadmins")
wait(0.166666667)
owners = data:GetAsync(dataKey.."-Owners")
wait(0.166666667)
headOwners = data:GetAsync(dataKey.."-HeadOwners")
wait(0.166666667)

bans = settings.Banned
mutes = settings.Muted
whitelist = settings.Whitelisted
blacklist = settings.Blacklisted

prefix = settings.Prefix
plrPrefix = settings.NonAdminPrefix
batch = settings.Seporator
split = settings.Split

consoleKey = settings.Console
allowConsole = settings.AllowConsole
maxLogs = settings.MaxLogCount
allowLogs = settings.AllowLogs
maxChatLogs = settings.MaxChatLogCount
alllowChatLogs = settings.AllowChatLogs

notifyAdmins = settings.NotifyAdmins
allowHelp = settings.AllowHelpCommand

descriptions = settings.Descriptions
commands = settings.Commands

warn("[XMAdmin]: Variable Initialization Complete.")
warn("[XMAdmin]: Starting Admin Initialization...")

function UpdateAdminTables()
    mods = data:GetAsync(dataKey.."-Mods")
    wait(0.166666667)
    admins = data:GetAsync(dataKey.."-Admins")
    wait(0.166666667)
    CO_admins = data:GetAsync(dataKey.."-COadmins")
    wait(0.166666667)
    COA_admins = data:GetAsync(dataKey.."-COAadmins")
    wait(0.166666667)
    owners = data:GetAsync(dataKey.."-Owners")
    wait(0.166666667)
    headOwners = data:GetAsync(dataKey.."-HeadOwners")
    wait(0.166666667)
    warn("[XMAdmin]: All Data Updated.")
end

function CheckAdminLevel()

end

function AdminMain(player,msg)
    print(player.Name..": "..msg)
    UpdateAdminTables()
end

game.Players.PlayerAdded:Connect(function(plr)
    plr.Chatted:Connect(function(message)
        AdminMain(plr,message)
    end)
end)

warn("[XMAdmin]: Admin Initialization Complete.")
warn("[XMAdmin]: XMAdmin is Ready.")

Settings Module:

local settings = {}

        settings.DataBase = "PRIVATE" --Data Base For Saving Data
        settings.DataBaseKey = "PRIVATE" --Key For Saved Data
        settings.SystemStorage = game:GetService("ReplicatedStorage")

        settings.Mods = {} --Moderators                     Format: ( "Username", "UserId", "GroupId", "GroupId:GroupRank" )
        settings.Admins = {} --Administrators               Format: ( "Username", "UserId", "GroupId", "GroupId:GroupRank" )
        settings.COadmins = {} --CO Admins                  Format: ( "Username", "UserId", "GroupId", "GroupId:GroupRank" )
        settings.COAadmins = {"Marineboy3O8"} --COA Admins                Format: ( "Username", "UserId", "GroupId", "GroupId:GroupRank" )
        settings.Owners = {} --Owners                       Format: ( "Username", "UserId", "GroupId", "GroupId:GroupRank" )
        settings.HeadOwners = {"KaiserVehosalmi"} --Head Owners              Format: ( "Username", "UserId", "GroupId", "GroupId:GroupRank" )

        settings.Banned = {"3144536:Betrail of Alience","1104961:Enemies"} --Banned Players               Format: ( "Username:Reason", "UserId:Reason", "GroupId:Reason", "GroupId:GroupRank:Reason" )
        settings.Muted = {} --Muted Players                 Format: ( "Username:Reason", "UserId:Reason", "GroupId:Reason", "GroupId:GroupRank:Reason" )
        settings.Whitelisted = {} --Whitelists              Format: ( "Username", "UserId", "GroupId", "GroupId:GroupRank" )
        settings.Blacklisted = {} --Blacklists              Format: ( "Username", "UserId", "GroupId", "GroupId:GroupRank" )

        settings.Prefix = ":"
        settings.NonAdminPrefix = ";"
        settings.Seporator = " "
        settings.Split = "|"

        settings.Console = "BackSlash"
        settings.AllowConsole = true

        settings.MaxLogCount = 200
        settings.AllowLogs = true

        settings.MaxChatLogCount = 300
        settings.AllowChatLogs = true

        settings.NotifyAdmins = true

        settings.AllowHelpCommand = false

        descriptions = {}

                descriptions.DataBaseSaved = "Admin Data Saved! ["..settings.DataBase.."]"
                descriptions.DataBaseKey = "Admin Data Key is: ["..settings.DataBaseKey.."]"

        commands = {}

                commands.cmds = "Displays a list of all the commands."
                commands.output = "Displays the admin output."
                commands.logs = "Displays the commands that are run."
                commands.chatlogs = "Displays what is typed in the chat."
                commands.playerlogs = "Displays the logs of the target."
                commands.list = "Displays a list of the players currently in the game and their rank."
                commands.gotoTeleport = "Teleports you to the target."
                commands.bringTeleport = "Teleports the target to you."
                commands.info = "Displays the copyright and admin info."

settings.Descriptions = descriptions
settings.Commands = commands

return settings

DataStore Module:

local data = {}

        local settings = require(game:GetService("ServerScriptService").XMAdmin.Settings)

        data.DataStore = game:GetService("DataStoreService"):GetDataStore(settings.DataBase)
        data.DataKey = settings.DataBaseKey

        warn("[XMAdmin]: Running DataStore...")

        data.mods = settings.Mods
        data.admins = settings.Admins
        data.COadmins = settings.COadmins
        data.COAadmins = settings.COAadmins
        data.owners = settings.Owners
        data.headOwners = settings.HeadOwners

        data.savedMods = data.DataStore:GetAsync(data.DataKey.."-Mods")
            if data.savedMods ~= nil then
                data.mods = data.savedMods
            end
        data.savedAdmins = data.DataStore:GetAsync(data.DataKey.."-Admins")
            if data.savedAdmins ~= nil then
                data.admins = data.savedAdmins
            end
        data.savedCOadmins = data.DataStore:GetAsync(data.DataKey.."-COadmins")
            if data.savedCOadmins ~= nil then
                data.COadmins = data.savedCOadmins
            end
        data.savedCOAadmins = data.DataStore:GetAsync(data.DataKey.."-COAadmins")
            if data.savedCOAadmins ~= nil then
                data.COAadmins = data.savedCOAadmins
            end
        data.savedOwners = data.DataStore:GetAsync(data.DataKey.."-Owners")
            if data.savedOwners ~= nil then
                data.owners = data.savedOwners
            end
        data.savedHeadOwners = data.DataStore:GetAsync(data.DataKey.."-HeadOwners")
            if data.savedHeadOwners ~= nil then
                data.headOwners = data.savedHeadOwners
            end

        data.DataStore:SetAsync(data.DataKey.."-Mods", data.mods)
        data.DataStore:SetAsync(data.DataKey.."-Admins", data.admins)
        data.DataStore:SetAsync(data.DataKey.."-COadmins", data.COadmins)
        data.DataStore:SetAsync(data.DataKey.."-COAadmins", data.COAadmins)
        data.DataStore:SetAsync(data.DataKey.."-Owners", data.owners)
        data.DataStore:SetAsync(data.DataKey.."-HeadOwners", data.headOwners)

        data.CheckPermission = function(permission)
                    local permissionTable
                    if permission == "Mods" then
                        permissionTable = data.mods
                    elseif permission == "Admins" then
                        permissionTable = data.admins
                    elseif permission == "COadmins" then
                        permissionTable = data.COadmins
                    elseif permission == "COAadmins" then
                        permissionTable = data.COAadmins
                    elseif permission == "Owners" then
                        permissionTable = data.owners
                    elseif permission == "HeadOwners" then
                        permissionTable = data.headOwners
                    end
                    return permissionTable
                end

        data.UpdatePermissions = function(player,permission,canOverride,remove,updater)
                    local permissionTable = data.CheckPermission(permission)
                    local playerName = player.Name
                    local playerId = player.UserId
                    if remove == false then
                        permissionTable[#permissionTable+1] = playerName
                    elseif remove then
                        for i = 1, #permissionTable do
                            if permissionTable[i] == playerName or permissionTable[i] == playerId then
                                table.remove(permissionTable,i)
                            end
                        end
                    end
                    data.DataStore:SetAsync(data.DataKey.."-"..permission, permissionTable)
                    warn("[XMAdmin]: "..permission.." Updated by "..updater.Name)
                    warn(settings.Descriptions.DataBaseSaved)
                end

return data
0
Please Help People! It would be really apriciated. SynthetickDev 188 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Try this:

plr.Chatted:connect(function(message)

and this:

game.Players.PlayerAdded:connect(function(plr)
0
'connect' is decrepted now use 'Connect' SynthetickDev 188 — 6y
Ad

Answer this question