I'm trying to script a command that gives a player a tool that's in my ReplicatedStorage.
If you're able to help me dm me on discord sore#6578 or you can help me here too.
here's what my Admin script looks like:
local commands = {}
local admins = {
"Osamiku";
"7mm0";
}
local prefix = ":"
local function findPlayer(name)
for _, player in pairs(game.Players:GetPlayers()) do
if string.lower(player.Name) == name then
return player
end
end
return nil
end
local function isAdmin(player)
for _, v in pairs(admins) do
if v == player.Name then
return true
end
end
return false
end
commands.tp = function(sender, arguments)
print("TP Function fired by "..sender.Name)
for i, playerName in pairs(arguments) do
print(playerName)
end
local playerToTeleportName = arguments[1]
local playerToTeleportToName = arguments[2]
if playerToTeleportName and playerToTeleportToName then
local plrToTP = findPlayer(playerToTeleportName)
local plrToTPTo = findPlayer(playerToTeleportToName)
if plrToTP and plrToTPTo then
plrToTP.Character.HumanoidRootPart.CFrame = plrToTPTo.Character.HumanoidRootPart.CFrame
print("Successfully moved!")
end
end
end
-- where i will put my new command --
--------------
commands.speed = function(sender, arguments)
print("Speed command fired by "..sender.Name)
local playerToGiveSpeedTo = arguments[1]
local amountOfSpeedToGive = arguments[2]
if playerToGiveSpeedTo then
local plr = findPlayer(playerToGiveSpeedTo)
if plr then
plr.Character.Humanoid.WalkSpeed = tonumber(amountOfSpeedToGive)
print(playerToGiveSpeedTo.." was given Walkspeed".. amountOfSpeedToGive)
end
end
end
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message,recipient)
if isAdmin(player) then
--
message = string.lower(message)
local splitString = message:split(" ") --
local colonCommand = splitString[1] --
local cmd = colonCommand:split(prefix)
local cmdName = cmd[2]
if commands[cmdName] then
local arguments = {}
for i = 2, #splitString, 1 do
table.insert(arguments,splitString[i])
end
commands[cmdName](player,arguments)
end
end
end)
end)
I'm just really confused since I am fairly new to scripting and I don't know how to make a command script that gives the player a tool.
again, you can help me here or my DMs are open on Discord @ sore#6578, thanks

1 comment
First: Watch tutorials. We won't make scripts for you, we just fix your errors. Second: This code is 111 lines long. We don't always have time to read that all, so only post the part that explains your question or helps us fix it.