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
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: How to make a message statement for !Shout

Previous Thread :: Next Thread 
Wizlyc is not online. Wizlyc
Joined: 27 Mar 2015
Total Posts: 312
19 Jan 2016 09:57 PM
If I want a command to work if a player says "!Shout" + adds their message, I need a statement that determines if they've said "!Shout", in their message. How can I do this?
Report Abuse
128Gigabytes is online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
19 Jan 2016 10:00 PM
https://www.youtube.com/watch?v=OvseAKgAIig

read description
Report Abuse
Wizlyc is not online. Wizlyc
Joined: 27 Mar 2015
Total Posts: 312
19 Jan 2016 10:05 PM
GroupID = 0
Ranks = {"RankName","RankName","RankName"}
cmds = {"!Uniform","!Shout"}
game.Players.PlayerAdded:connect(function(plr)
plr.Chatted:connect(function(msg)
local rank = plr:GetRoleInGroup(GroupID)
for i = 1,#Ranks do
if rank == Ranks[i] then
if msg == then -- this is the part im stuck on
end
end
end
end)
end)
Report Abuse
Wizlyc is not online. Wizlyc
Joined: 27 Mar 2015
Total Posts: 312
19 Jan 2016 10:07 PM
Bump
Report Abuse
Wizlyc is not online. Wizlyc
Joined: 27 Mar 2015
Total Posts: 312
19 Jan 2016 10:10 PM
Bump2
Report Abuse
hkep is not online. hkep
Joined: 19 Jul 2014
Total Posts: 550
19 Jan 2016 10:12 PM
GroupID = 0
Ranks = {"RankName","RankName","RankName"} -- ok
cmds = {"!Uniform","!Shout"} -- these need a function to call with (message)
game.Players.PlayerAdded:connect(function(plr)
plr.Chatted:connect(function(msg)
local rank = plr:GetRoleInGroup(GroupID)
for i = 1,#Ranks do
if rank == Ranks[i] then -- needs to connect an event (plr.Chatted) and then break
if msg == then -- goes in an event

end
end
end
end)
end)



Report Abuse
hkep is not online. hkep
Joined: 19 Jul 2014
Total Posts: 550
19 Jan 2016 10:15 PM
GroupID = 0
Ranks = {"RankName","RankName","RankName"} -- ok
cmds = {"!Uniform","!Shout"} -- these need a function to call with (message)
game.Players.PlayerAdded:connect(function(plr)
local rank = plr:GetRoleInGroup(GroupID)
for i = 1,#Ranks do
if rank == Ranks[i] then -- needs to connect an event (plr.Chatted) and then break
if msg == then -- goes in an event
-- string.sub(msg,1,string.len("!Shout")) == "!Shout"
end
end
end
end)


my bad im tired rn, and didn't see it was already in an event. Put the event in the if statement
Report Abuse
Wizlyc is not online. Wizlyc
Joined: 27 Mar 2015
Total Posts: 312
19 Jan 2016 10:19 PM
Yo all im trying to do is check if the message says "!Shout" + the message they want to shout..
Report Abuse
Wizlyc is not online. Wizlyc
Joined: 27 Mar 2015
Total Posts: 312
19 Jan 2016 10:22 PM
Bump
Report Abuse
hkep is not online. hkep
Joined: 19 Jul 2014
Total Posts: 550
19 Jan 2016 10:42 PM
local msg = ""
local cmd = "!Shout"

local s = string.sub
local l = string.len

if cmd == s( msg, 1, l(cmd) ) then
local shout = s(msg, l(cmd)+1, l(msg) )
-- so string.sub substrings the msg with the length of cmd plus 1 to the length of msg
-- substring is given with a start and end. it returns part of that string
end

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