generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: How to make chat commands?

Previous Thread :: Next Thread 
Trfe2000 is not online. Trfe2000
Joined: 23 Apr 2016
Total Posts: 73
22 Sep 2017 02:01 PM
I want to make commands that when I type for example "/play [name]" a song will start/stop or whatever .-.
Just in general, how can I make it recognise certain chat texts?
Report Abuse
IAmBW is online. IAmBW
Joined: 13 Jan 2013
Total Posts: 698
22 Sep 2017 02:33 PM
es.


~IAmBW / Aspiring Developer / Scripter / Builder and GFX artist
Report Abuse
Laedere is online. Laedere
Joined: 17 Jun 2013
Total Posts: 23601
22 Sep 2017 02:33 PM
With a script


Report Abuse
PrimeStarxxx is not online. PrimeStarxxx
Joined: 09 May 2017
Total Posts: 88
22 Sep 2017 02:40 PM
well if u put a localscript in a player

plr = game.Players.LocalPlayer

plr.Chatted:connect(function(msg)


if string.sub(msg,1,5) == "/play" then

sound = Instance.new("Sound",plr.PlayerGui)

sound.SoundId = string.sub(msg,5)

sound.Playing = true


end

end)



then all u would have to do is chat /play --sound id--
Report Abuse
Laedere is online. Laedere
Joined: 17 Jun 2013
Total Posts: 23601
22 Sep 2017 02:40 PM
^ i suggest you have a dictionary of commands so you don't have to use if statements to check which command it is


Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
22 Sep 2017 02:45 PM
look into my psuedo admin in my models, it's pretty easy to configure and do stuff with
Report Abuse
PrimeStarxxx is not online. PrimeStarxxx
Joined: 09 May 2017
Total Posts: 88
22 Sep 2017 02:52 PM
my bad heres a better version

plr = game.Players.LocalPlayer

plr.Chatted:connect(function(msg)


if string.sub(msg,1,5) == "/play" then

local sound = Instance.new("Sound",plr.PlayerGui)

sound.SoundId = string.sub(msg,6)

sound.Playing = true


end

end)

this actully works now lol in chat type /play --soundid-- and t will work
Report Abuse
soutenu is online. soutenu
Joined: 09 Dec 2011
Total Posts: 1021
22 Sep 2017 02:53 PM
Chatted and basic string manipulation
Report Abuse
RSASDSA is not online. RSASDSA
Joined: 23 Mar 2017
Total Posts: 34
22 Sep 2017 03:05 PM
if you want to make the command not show up in chat:
you can use a chat module, get the channel All using GetChannel, and use RegisterProcessCommandsFunction.
I'm bad at explaining this, so look on the wiki
http://wiki.roblox.com/index.php?title=Lua_Chat_System/Server_API/ChatChannel#RegisterProcessCommandsFunction
http://wiki.roblox.com/index.php?title=Lua_Chat_System


game:GetService("RobloxForumService"):GetForum("Let's Make A Deal"):Destroy()
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image