IMPORTANT NOTE
I want to get this out of the way first…
I KNOW THERE’S ANOTHER WAY TO EXECUTE THIS LINE OF CODE.
if Players:GetNameFromUserIdAsync(plr.UserId) == BanName then
I have chosen to use this line on my own and I’d prefer to use this line of code instead of changing it.
Achieve
Alright so, I’m working on a admin module for stuff such to control certain things such as a G.U.I that works through Events and such.
Issue
The issue is whenever I try to use the Module, it doesn’t work and I have no idea why.
Solutions
I’ve done everything, from rescripting the entire thing as you’ll see. I’ve attempted to remove certain features and separate the Execute Script to multiple scripts… to no prevail. I am completely lost.
Scripts
Execute Script
--Made By MillerrIAm
--------Variables-------
local GUIName = "ControlUI" --[Change this to the name of your controls.]--
local plr = game:GetService("Players")
local playerCheck = require(game.ServerScriptService["Scripts|Admins"]["ModuleScript|AdminCheck"])
--------Main Code------
--[ControlUI Protocol]
coroutine.wrap(plr.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if playerCheck.Admin(player) then
wait(0.05)
plr.PlayerGui[GUIName]:Destroy()
warn("Admin Protocol Completed")
end
end)
end))
--[Ban Protocol]
coroutine.wrap(function()
plr.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if playerCheck.Banned(player) then
wait(0.05)
warn("Ban Protocol Completed")
local alertmsg = Instance.new("Hint",game.Workspace)
alertmsg.Text = player.Name.." attemped to join the game."
player:Kick("You're prohibited from entering this game.")
end
end)
end)
end)
--[Whitelist Protocol]
coroutine.wrap(function()
plr.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if playerCheck.Whitelist(player) then
wait(0.05)
warn("Whitelist Protocol Completed")
end
end)
end)
end)
Admin Module Script
--[Made By MillerrIAm]--
--[Some ideas illustrated are inspired by kidzrock4 & TerryMichaelBrunk]--
------------------------------[Variables]------------------------------
local Players = game:GetService("Players")
---------[Settings]--------
local Kick = true --Kicks people if they exploit the controls.
local Alert = true --Alerts the server of who attempted to exploit the controls.
local Whitelist = false --Turn this on if you only want certain people to be able to join your game.
local CreatorAdmin = false --Turn this on if you want the creator to have access to the system.
------[Group Settings]-----
local GroupAdmin = false --Checks the Group to see if the person is at/is higher than the GroupRankRequirement.
local GroupID = 0 --Group ID
local GroupRankRequirement = 255 --Max: 255, Min = 1
---------[Admins]--------
--[I recommend using the AdminID over the name due to the name changing ability.]--
local AdminIDs = {}
local AdminNames = {}
---------[Bans]--------
--[I recommend using the BanID over the name due to the name changing ability.]--
local BanIDs = {}
local BanNames = {"MillerrIAm"}
---------[Whitelist]--------
--[I recommend using the WhitelistID over the name due to the name changing ability.]--
local WhitelistIDs = {}
local WhitelistNames = {}
------------------------------[Main Code]------------------------------
local playerCheck = {}
function playerCheck.Banned(plr)
for i,BanID in ipairs(BanIDs) do
for i,BanName in ipairs(BanNames) do
if Players:GetNameFromUserIdAsync(plr.UserId) == BanName then
print("Banned Person Joined")
return true
elseif Players:GetUserIdFromNameAsync(plr.Name) == BanID then
print("Banned Person Joined")
return true
end
end
end
end
function playerCheck.Failed(plr) --[Fail meaning an Alert/Kick Function]--
if Alert then
spawn(function()
local alertmsg = Instance.new("Hint",game.Workspace)
alertmsg.Text = plr.Name .. " tried to exploit the controls."
plr:Kick("Don't try to exploit the controls.")
wait(5)
alertmsg:Destroy()
end)
end
if Kick then
plr:Kick("Don't try to exploit the controls.")
end
end
return playerCheck
Thank you for any help you can give me.