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
|
  |
| 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
|
  |
| Joined: 17 Jun 2013 |
| Total Posts: 23601 |
|
| |
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 09 Dec 2011 |
| Total Posts: 1021 |
|
|
| 22 Sep 2017 02:53 PM |
| Chatted and basic string manipulation |
|
|
| Report Abuse |
|
|
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 |
|
|