So I wondering, how to make a command my how do I make it if that person has perms it will work so I was trying to make a command that does. If I say "/update" then EVERYONE THAT IS PLAYING THE GAME TELEPORTS TO A GAME FOR 15 SECONDS THEN THEY TELEPORT BACK. this is for the game to get updated. Any forum or script examples thank you. :D Have a nice day.
Unsure how to make so the players get teleported back, you'd probably have to script that in the other place yourself.
For teleporting everyone to another place you can use this.
local placeID = 180364455 local teleportMessage = "teleport" local admin = "Alibolly" game.Players.PlayerAdded:Connect(function(plr) plr.Chatted:Connect(function(string) if string == teleportMessage and tostring(plr) == admin then local TS = game:GetService("TeleportService") for i = 1, #game.Players:GetChildren() do TS:Teleport(placeID, game.Players:GetChildren()[i]) end end end) end)
There are some values that you can change for your preferences.
If you don't want to get teleported yourself, then this script will exclude you from being teleported.
local placeID = 180364455 local teleportMessage = "teleport" local admin = "Alibolly" game.Players.PlayerAdded:Connect(function(plr) plr.Chatted:Connect(function(string) if string == teleportMessage and tostring(plr) == admin then local TS = game:GetService("TeleportService") for i = 1, #game.Players:GetChildren() do if not game.Players:GetChildren()[i].Name == admin then TS:Teleport(placeID, game.Players:GetChildren()[i]) end end end end) end)
Haven't tested if it works with all players, only one player. But hopefully this works :)
Hello there, RBLXNogin here and I have a solution to your problem. You have two issues: writing commands, and the ability to only let admins to them. Well, in that case let me introduce something known as "Chatted", which is an event to control what happens when a message is sent. You can manipulate this in order to make a /cmd (aka detecting when the command is typed). First, let me give you a quick definition of ROBLOX events.
An event is when a set of instructions are run into the application (ROBLOX GAME), when a certain action is completed. Here is a basic example of a event:
game.Workspace.Part.Touched:Connect(function(hit) print("The part has been touched!") end)
This code detects when the action of workspace.Part is touched, and if so then it will execute the following code. Understand? The "Touched" event has to be a "member" of the object that you want to give the event to. Well into a typical Chatted event we want to detect which player talked. In that scenario, we need to first use PlayerAdded inorder to pass a plr parameter. PlayerAdded is an event that executes when a new player joins the game, and we can pass a player parameter. Here is an example:
game.Players.PlayerAdded:Connect(function(plr) --code for when a player joins the game end)
In order to activate chatted, we need to make it a member of the "plr" parameter.
game.Players.PlayerAdded:Connect(function(plr) --code for when a player joins the game plr.Chatted:Connect(function(msg) --code for when that player says something in Chat end) end)
Now do you understand? So far our script detects when a player joins the game and says something in chat. Everytime a player activated the Chatted event by using a message, we can detect what is is, and most importantly, if it is a command. Here for example let me show you a basic :KickMe command:
game.Players.PlayerAdded:Connect(function(plr) --code for when a player joins the game plr.Chatted:Connect(function(msg) if msg == ":KickMe()" then --Code for when a player types ":KickMe" plr:Kick("You have been kicked yourself from the server") end end) end)
Perfect! Now see how we can use Chatted events to make your own command? Here is another good example:
game.Players.PlayerAdded:Connect(function(plr) plr.Chatted:Connect(function(msg) if msg == "/addBrick" then local part = Instance.new("Part") part.Parent = workspace. part.Position = Vector3.new(0,0,0) end end) end)
The command above says that when you type "/addBrick" it creates a brick in the workspace with the coordinates (0,0,0). Pretty neat huh?
The last solution is to make only certain players able to do this. Here you have to detect is the player is allowed, then execute the code. Here is how you will accomplish this:
game.Players.PlayerAdded:Connect(function(plr) if plr.Name == "RBLXNogin" then --Name of Admin plr.Chatted:Connect(function(msg) if msg == "/poo" then print("RBLXNogin, the admin, has typed 'poo'") end end) end
See that? This is the basics to making your own custom admin commands. Now all is that is left is for you to mark my awnser and help me gain reputation on ScriptingHelpers :)