Command for vip server owners

I make script that specifying owners of vip server… that make them use the command on vip server whats wrong in this script?

 local ReplicatedStorage = game:GetService("ReplicatedStorage")
    local ServerStorage = game:GetService("ServerStorage")
    local Players = game:GetService("Players")
    local commands = ServerStorage.VipCommands

    if game.PrivateServerOwnerId ~= "" and game.PrivateServerOwnerId ~= 0 then
    	Players.PlayerAdded:Connect(function(Players)
    		local Vip = game.PrivateServerOwnerId ~= "" and game.PrivateServerOwnerId ~= 0
    	
    	local prefix = "/" -- Change this to the starting character

    	game.Players.PlayerAdded:Connect(function(Player)
    		Player.Chatted:Connect(function(message)
    			if not table.find(Vip, Player.Name) then return end
    			if message:sub(1, #prefix) ~= prefix then return end

    			local args = message:split(" ")
    			local cmd = args[1]:sub(#prefix + 1, #args[1]):lower()
    			table.remove(args, 1)

    			if not commands:FindFirstChild(cmd) then return end
    			spawn(function()
    				require(commands[cmd]).run(Player, message, args)
    			end)
    		end)
    	end)
    end)
1 Like

Can you tell us what the error is /what’s not working?

Can you send us the output if any?

You have defined player added twice within each other, no wonder it doesn’t work.