Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make custom admin commands?

Hello. I have been working on a RPG game and im almost done.. But i need to put custom admin commands in the game like ";give adminsword guy" and everytime i try to make that i fail so i need help.

7 comments

0

Please present your current attempts.

0

We cannot directly help you, heres a concept, detects a player joined, detect if the guy name is adhamahmed777, detects if he say ";givetool userID gearID", store userID and gearID in a table, get the player from table, locate if he is in server, if yes, clone GearID into Player's inventory.

0

If you are kind of new, don't do really hard projects, also Kohl Admin Commands are a very good toolkit. We won't give you any script.

0

Usernames are not reliable UIDs, use the User's UserId, as it is a static identifier.

0

Regular Expressions are the best way to process text-based commands.

0

I recommend you learn on chat events, if the player userid is in the admin table let's say they have those commands.

0

Look at a tutorial on youtube

2 answers

✓ Accepted answer

Here ya go, i left some comments so its easier to understand.

local players = game:GetService("Players")
local Sword = game:GetService("ReplicatedStorage").ClassicSword --Path to the sword
players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		if msg == ";sword" then --Checks if the message was the command
			local clone = Sword:Clone() --Clones the sword
			clone.Parent = player.Backpack --Puts the clone in Player's Backpack
		end
	end)
end)

Edit: Version with a AdminList Note:To make the admin list work, you need to make a folder called Admins in ReplicatedStorage, Add Children that have the name of the admins (Doesnt matter what type are they)

local players = game:GetService("Players")
local Sword = game:GetService("ReplicatedStorage").ClassicSword --Path to the sword
local AdminList = game:GetService("ReplicatedStorage").Admins
players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		if msg == ";sword" then --Checks if the message was the command
			for i,admin in pairs(AdminList:GetChildren()) do
				if admin.Name == tostring(player) then
					local clone = Sword:Clone() --Clones the sword
					clone.Parent = player.Backpack --Puts the clone in Player's Backpack
				end
			end
		end
	end)
end)

2 comments

0

Also dont think tostring() is neccesary here XD

0

OH MY GOD THAT WILL HELP ALOT THANKS

idk how to mention a player but i know how to make a command like speed

like !speed he will then change the speed to 100

try this script use a serverscript normal script

``

game.Players.PlayerAdded:Connect(function(player)

player.chatted:connect(function(message)
	if message == "!speed" then
		local firstplayer = game.Workspace:FindFirstChildWhichIsA("Humanoid")
		firstplayer.Humanoid.WalkSpeed = 100
	end
	
	
	
end)

end)

``

but try to learn from basic

1 comment

0

thats cool

This discussion is preserved as it was. New answers, comments, and votes are closed.