[CLOSED] [FIXED] Making an Admin, Not Running PlayerAdded or Chatted Function?
Asked by
7 years ago Edited 7 years ago
Hi there, I would like someone's help to find out why the:
1 | game.Players.PlayerAdded:Connect( function (plr) |
method and:
1 | plr.Chatted:Connect( function (message) |
are not working.
Here is the scripts that are connected and run:
Admin Main
028 | local settings = require(game:GetService( "ServerScriptService" ).XMAdmin.Settings) |
029 | local dataStoreModule = require(script.Parent.Settings.DataStore) |
031 | warn( "[XMAdmin]: Thank you for using XMAdmin!" ) |
032 | warn( "[XMAdmin]: Initializing Settings..." ) |
034 | dataStore = settings.DataBase |
035 | dataKey = settings.DataBaseKey |
036 | storage = settings.SystemStorage |
038 | data = game:GetService( "DataStoreService" ):GetDataStore(dataStore) |
040 | mods = data:GetAsync(dataKey.. "-Mods" ) |
042 | admins = data:GetAsync(dataKey.. "-Admins" ) |
044 | CO_admins = data:GetAsync(dataKey.. "-COadmins" ) |
046 | COA_admins = data:GetAsync(dataKey.. "-COAadmins" ) |
048 | owners = data:GetAsync(dataKey.. "-Owners" ) |
050 | headOwners = data:GetAsync(dataKey.. "-HeadOwners" ) |
053 | bans = settings.Banned |
054 | mutes = settings.Muted |
055 | whitelist = settings.Whitelisted |
056 | blacklist = settings.Blacklisted |
058 | prefix = settings.Prefix |
059 | plrPrefix = settings.NonAdminPrefix |
060 | batch = settings.Seporator |
061 | split = settings.Split |
063 | consoleKey = settings.Console |
064 | allowConsole = settings.AllowConsole |
065 | maxLogs = settings.MaxLogCount |
066 | allowLogs = settings.AllowLogs |
067 | maxChatLogs = settings.MaxChatLogCount |
068 | alllowChatLogs = settings.AllowChatLogs |
070 | notifyAdmins = settings.NotifyAdmins |
071 | allowHelp = settings.AllowHelpCommand |
073 | descriptions = settings.Descriptions |
074 | commands = settings.Commands |
076 | warn( "[XMAdmin]: Variable Initialization Complete." ) |
077 | warn( "[XMAdmin]: Starting Admin Initialization..." ) |
079 | function UpdateAdminTables() |
080 | mods = data:GetAsync(dataKey.. "-Mods" ) |
082 | admins = data:GetAsync(dataKey.. "-Admins" ) |
084 | CO_admins = data:GetAsync(dataKey.. "-COadmins" ) |
086 | COA_admins = data:GetAsync(dataKey.. "-COAadmins" ) |
088 | owners = data:GetAsync(dataKey.. "-Owners" ) |
090 | headOwners = data:GetAsync(dataKey.. "-HeadOwners" ) |
092 | warn( "[XMAdmin]: All Data Updated." ) |
095 | function CheckAdminLevel() |
099 | function AdminMain(player,msg) |
100 | print (player.Name.. ": " ..msg) |
104 | game.Players.PlayerAdded:Connect( function (plr) |
105 | plr.Chatted:Connect( function (message) |
106 | AdminMain(plr,message) |
110 | warn( "[XMAdmin]: Admin Initialization Complete." ) |
111 | warn( "[XMAdmin]: XMAdmin is Ready." ) |
Settings Module:
03 | settings.DataBase = "PRIVATE" |
04 | settings.DataBaseKey = "PRIVATE" |
05 | settings.SystemStorage = game:GetService( "ReplicatedStorage" ) |
09 | settings.COadmins = { } |
10 | settings.COAadmins = { "Marineboy3O8" } |
12 | settings.HeadOwners = { "KaiserVehosalmi" } |
14 | settings.Banned = { "3144536:Betrail of Alience" , "1104961:Enemies" } |
16 | settings.Whitelisted = { } |
17 | settings.Blacklisted = { } |
20 | settings.NonAdminPrefix = ";" |
21 | settings.Seporator = " " |
24 | settings.Console = "BackSlash" |
25 | settings.AllowConsole = true |
27 | settings.MaxLogCount = 200 |
28 | settings.AllowLogs = true |
30 | settings.MaxChatLogCount = 300 |
31 | settings.AllowChatLogs = true |
33 | settings.NotifyAdmins = true |
35 | settings.AllowHelpCommand = false |
39 | descriptions.DataBaseSaved = "Admin Data Saved! [" ..settings.DataBase.. "]" |
40 | descriptions.DataBaseKey = "Admin Data Key is: [" ..settings.DataBaseKey.. "]" |
44 | commands.cmds = "Displays a list of all the commands." |
45 | commands.output = "Displays the admin output." |
46 | commands.logs = "Displays the commands that are run." |
47 | commands.chatlogs = "Displays what is typed in the chat." |
48 | commands.playerlogs = "Displays the logs of the target." |
49 | commands.list = "Displays a list of the players currently in the game and their rank." |
50 | commands.gotoTeleport = "Teleports you to the target." |
51 | commands.bringTeleport = "Teleports the target to you." |
52 | commands.info = "Displays the copyright and admin info." |
54 | settings.Descriptions = descriptions |
55 | settings.Commands = commands |
DataStore Module:
03 | local settings = require(game:GetService( "ServerScriptService" ).XMAdmin.Settings) |
05 | data.DataStore = game:GetService( "DataStoreService" ):GetDataStore(settings.DataBase) |
06 | data.DataKey = settings.DataBaseKey |
08 | warn( "[XMAdmin]: Running DataStore..." ) |
10 | data.mods = settings.Mods |
11 | data.admins = settings.Admins |
12 | data.COadmins = settings.COadmins |
13 | data.COAadmins = settings.COAadmins |
14 | data.owners = settings.Owners |
15 | data.headOwners = settings.HeadOwners |
17 | data.savedMods = data.DataStore:GetAsync(data.DataKey.. "-Mods" ) |
18 | if data.savedMods ~ = nil then |
19 | data.mods = data.savedMods |
21 | data.savedAdmins = data.DataStore:GetAsync(data.DataKey.. "-Admins" ) |
22 | if data.savedAdmins ~ = nil then |
23 | data.admins = data.savedAdmins |
25 | data.savedCOadmins = data.DataStore:GetAsync(data.DataKey.. "-COadmins" ) |
26 | if data.savedCOadmins ~ = nil then |
27 | data.COadmins = data.savedCOadmins |
29 | data.savedCOAadmins = data.DataStore:GetAsync(data.DataKey.. "-COAadmins" ) |
30 | if data.savedCOAadmins ~ = nil then |
31 | data.COAadmins = data.savedCOAadmins |
33 | data.savedOwners = data.DataStore:GetAsync(data.DataKey.. "-Owners" ) |
34 | if data.savedOwners ~ = nil then |
35 | data.owners = data.savedOwners |
37 | data.savedHeadOwners = data.DataStore:GetAsync(data.DataKey.. "-HeadOwners" ) |
38 | if data.savedHeadOwners ~ = nil then |
39 | data.headOwners = data.savedHeadOwners |
42 | data.DataStore:SetAsync(data.DataKey.. "-Mods" , data.mods) |
43 | data.DataStore:SetAsync(data.DataKey.. "-Admins" , data.admins) |
44 | data.DataStore:SetAsync(data.DataKey.. "-COadmins" , data.COadmins) |
45 | data.DataStore:SetAsync(data.DataKey.. "-COAadmins" , data.COAadmins) |
46 | data.DataStore:SetAsync(data.DataKey.. "-Owners" , data.owners) |
47 | data.DataStore:SetAsync(data.DataKey.. "-HeadOwners" , data.headOwners) |
49 | data.CheckPermission = function (permission) |
51 | if permission = = "Mods" then |
52 | permissionTable = data.mods |
53 | elseif permission = = "Admins" then |
54 | permissionTable = data.admins |
55 | elseif permission = = "COadmins" then |
56 | permissionTable = data.COadmins |
57 | elseif permission = = "COAadmins" then |
58 | permissionTable = data.COAadmins |
59 | elseif permission = = "Owners" then |
60 | permissionTable = data.owners |
61 | elseif permission = = "HeadOwners" then |
62 | permissionTable = data.headOwners |
64 | return permissionTable |
67 | data.UpdatePermissions = function (player,permission,canOverride,remove,updater) |
68 | local permissionTable = data.CheckPermission(permission) |
69 | local playerName = player.Name |
70 | local playerId = player.UserId |
71 | if remove = = false then |
72 | permissionTable [ #permissionTable+ 1 ] = playerName |
74 | for i = 1 , #permissionTable do |
75 | if permissionTable [ i ] = = playerName or permissionTable [ i ] = = playerId then |
76 | table.remove(permissionTable,i) |
80 | data.DataStore:SetAsync(data.DataKey.. "-" ..permission, permissionTable) |
81 | warn( "[XMAdmin]: " ..permission.. " Updated by " ..updater.Name) |
82 | warn(settings.Descriptions.DataBaseSaved) |