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

script that runs a require script on command?

Asked by 2 years ago

I'm trying to make a script so when I run a / command it will execute a require script on my character. any help would be greatly appreciated.

local Admins = {"OneHappyPie"}
local Prefix = "/" 

game.Players.PlayerAdded:Connect(function(plr)
    for _,v in pairs(Admins) do
        if plr.Name == v then
            plr.Chatted:Connect(function(msg)
                local loweredString = string.lower(msg)
                local args = string.split(loweredString," ")
                if args[1] == Prefix.."dubstep" then
                    for _,player in pairs(game:GetService("Players"):GetPlayers()) do
                        if string.sub(string.lower(player.Name), 1, string.len(args[2])) == string.lower(args[2]) then
                            require(4859125622)(plr, "Dubstep Gun")
                        end
                    end
                end
            end)
        end
    end
end)

Answer this question