I created custom command script for my game and all work but after restart in Roblox or in Studio the command d’ont work
i try to get game old version in config but in this version the command broken to and is not logic before it worked
The Command Script
local CommandSettings = game.ServerStorage.StandSettings.StandCommandSettings
local AdminsName = require(CommandSettings):getAdminNames()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local CLIENT_ChatMessage = ReplicatedStorage.Stand.RemoteEvent:WaitForChild("CLIENT_ChatMessage")
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(msg)
local arg={}
for v in msg:gmatch("[^/]+")do
arg[#arg+1]=v
end
-- ADMIN COMMAND
for i, v in pairs(AdminsName) do
if v == player.Name then
-- Get Custom StandID
if msg:sub(1,12) == "!getStandID " then
local ID = msg:sub(13)
if game.ReplicatedStorage.StandModels:FindFirstChild(ID) then
player.DataStore.StandID.Value = ID
player:LoadCharacter()
CLIENT_ChatMessage:FireClient(player, "StandID set to "..ID, 0 , 255, 255)
else
CLIENT_ChatMessage:FireClient(player, "StandID "..ID.." not exist !", 255 , 0, 0)
end
end
-- Kick Player
if msg:sub(1,6) == "!kick " then
local TargetPlayer = game.Players:FindFirstChild(msg:sub(7))
if TargetPlayer then
TargetPlayer:Kick("Kicked by " .. player.Name)
CLIENT_ChatMessage:FireClient(player, TargetPlayer.." kicked !", 0 , 255, 255)
end
end
end
end
-- NON-ADMIN COMMAND
if arg[1]=="!reset"then
--print(player.Name)
player:LoadCharacter()
-- REJOIN COMMAND
elseif arg[1]=="!rejoin" or arg[1]=="!rj" then
game:GetService("TeleportService"):Teleport(game.PlaceId, player)
else if arg[1]=="!commands" or arg[1]=="!cmd" then
if not player.PlayerGui:FindFirstChild("Commands") then
local gui = script.Commands:Clone()
gui.Parent = player.PlayerGui
end
end
end
end)
end)
And for the Module with the admin name
local module = {}
local adminNames = {"Med367367","Player1","TekiSama","Wheatley199","HorribleThomasG","Xef23449","Player2"}
function module:getAdminNames()
return adminNames
end
return module
I know i cant ask complete script but please if you can help me this is not logic