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: Why's the message command not creating a message?

Previous Thread :: Next Thread 
TheeDeathCaster is not online. TheeDeathCaster
Joined: 19 Jun 2011
Total Posts: 1191
04 Jul 2016 04:30 PM
Today I have created a new command for my AC system, but it turns out it isn't working for some reason: it is not creating a message. I have added prints to my code, and all have appeared to work for all variables used; I can't seem to figure out what the problem is now, since there're no errors popping up, and all prints are executing.

This is my current code:

if msg:lower():sub(1, 4) == 'tpm ' then
print(0)
local chk1 = msg:sub(5):find(' ') + 4
print(1)
local chk2 = msg:sub(chk1 + 1):find(' ') + 4
print(2)
local Time = math.min(tonumber(msg:sub(5, chk1 - 1)), 60) or (#msg:sub(chk1 + 1) / 35) + 2.5
print(3)
local plrz = GetPlayers(plr, msg:sub(chk1 + 1, chk2 - 1)) or GetPlayers(plr, msg:sub(5, chk1 - 1))
print(4)
local Msg = msg:sub(chk2 + 1) or msg:sub(chk1 + 1)
print(5)
for i, v in pairs(plrz) do
spawn(function()
CreateMessage(v, plr.Name .. ': ' .. Msg, Time)
end)
end
end


Now, look up in the upper-right corner of your screen, that red box there: that's the door.
Report Abuse
DiamondBladee is not online. DiamondBladee
Joined: 24 Feb 2013
Total Posts: 3527
04 Jul 2016 04:34 PM
The error likely resides in the CreateMessage function.


"Tell me and I forget. Teach me and I remember. Involve me and I learn." - Benjamin Franklin
Report Abuse
TheeDeathCaster is not online. TheeDeathCaster
Joined: 19 Jun 2011
Total Posts: 1191
04 Jul 2016 04:39 PM
@DiamondBladee CreateMessage works w/ other commands similar to command 'tpm,' so I doubt that CreateMessage is the main problem; however, if you mean that the variables are not working w/ CreateMessage, then I'll look into that, and I'll bring back the result here after checking.


Now, look up in the upper-right corner of your screen, that red box there: that's the door.
Report Abuse
TheeDeathCaster is not online. TheeDeathCaster
Joined: 19 Jun 2011
Total Posts: 1191
04 Jul 2016 04:43 PM
@DiamondBladee I just removed the 'ypcall' and 'spawn' functions, and there're still no errors or feedback on the problem.


Now, look up in the upper-right corner of your screen, that red box there: that's the door.
Report Abuse
DiamondBladee is not online. DiamondBladee
Joined: 24 Feb 2013
Total Posts: 3527
04 Jul 2016 04:45 PM
Are there any commands that do almost the exact same thing? See if you can spot a difference that may be unintended.


"Tell me and I forget. Teach me and I remember. Involve me and I learn." - Benjamin Franklin
Report Abuse
TheeDeathCaster is not online. TheeDeathCaster
Joined: 19 Jun 2011
Total Posts: 1191
04 Jul 2016 04:49 PM
@DiamondBladee Nope; CreateMessage is used the same way w/ other commands using it, and 'tm' uses similar code, only w/o the 'chk2' for 'plrz'.


Now, look up in the upper-right corner of your screen, that red box there: that's the door.
Report Abuse
TheeDeathCaster is not online. TheeDeathCaster
Joined: 19 Jun 2011
Total Posts: 1191
04 Jul 2016 08:22 PM
@DiamondBladee I did a bit more digging, and I found the problem isn't the command, nor CreateMessage; believe it or not, it's the GetPlayers function that isn't working correctly: for some reason, it is returning 0 players in the list for some reason, even when I chat ':kill all.'

Strange part is that GetPlayers was working previously before I added 'tpm.' e_e


Now, look up in the upper-right corner of your screen, that red box there: that's the door.
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
04 Jul 2016 08:23 PM
I know Kohl's Admin when I see it. Are you sure "CreateMessage" exists?


-=[ RAP: 345,047 || DurstAuric; the narb of ROBLOX ]=-
Report Abuse
TheeDeathCaster is not online. TheeDeathCaster
Joined: 19 Jun 2011
Total Posts: 1191
04 Jul 2016 08:31 PM
Yes..? Because it is within my AC?

And if you're thinking I stole code from Kohl, I didn't; maybe years ago when I uploaded 'fixed' scripts of his admin (not really 'fixed' though), but I make my ACs as of today; you may see a resemblance between his & mine because I took reference from his AC in the past to help me w/ coding issues, and it kinda grew on me and became apart of my coding style.


Now, look up in the upper-right corner of your screen, that red box there: that's the door.
Report Abuse
TheeDeathCaster is not online. TheeDeathCaster
Joined: 19 Jun 2011
Total Posts: 1191
04 Jul 2016 09:05 PM
Thread bump


Now, look up in the upper-right corner of your screen, that red box there: that's the door.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
04 Jul 2016 09:08 PM
stop using khols and make ur own


Report Abuse
TheeDeathCaster is not online. TheeDeathCaster
Joined: 19 Jun 2011
Total Posts: 1191
04 Jul 2016 09:09 PM
@TimeTicks Re-read my post, then try again. :)


Now, look up in the upper-right corner of your screen, that red box there: that's the door.
Report Abuse
TheeDeathCaster is not online. TheeDeathCaster
Joined: 19 Jun 2011
Total Posts: 1191
04 Jul 2016 09:54 PM
Thread bump [2]


Now, look up in the upper-right corner of your screen, that red box there: that's the door.
Report Abuse
TheeDeathCaster is not online. TheeDeathCaster
Joined: 19 Jun 2011
Total Posts: 1191
04 Jul 2016 11:12 PM
Thread bump [3]


Now, look up in the upper-right corner of your screen, that red box there: that's the door.
Report Abuse
TheeDeathCaster is not online. TheeDeathCaster
Joined: 19 Jun 2011
Total Posts: 1191
06 Jul 2016 02:22 PM
Welp, I just found the problem; apparently, I needed to use chk1 for chk2, as 'chk2 = msg:sub(chk1 + 1):find(' ') + chk1' for some reason..? e_o Like, what..? How did that one, small minor factor cause such a huge mess? I'm genuinely dumbfounded atm. e_e


Now, look up in the upper-right corner of your screen, that red box there: that's the door.
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
06 Jul 2016 02:24 PM
We probably could've helped if you hadn't used Kohl's older way of making admin commands. The formal way of doing this is adding the message's content into a script and then using array's to compare the results before firing the command.


-=[ RAP: 345,308 || DurstAuric; the narb of ROBLOX ]=-
Report Abuse
TheeDeathCaster is not online. TheeDeathCaster
Joined: 19 Jun 2011
Total Posts: 1191
06 Jul 2016 02:28 PM
@DurstAuric I don't think I know how to do that? e_e
Only other way I've seen it used in a different way is Person299's admin, but that uses for iterations to find the spaces instead of the find function.

Mind explaining & showing how I can do what you suggested?


Now, look up in the upper-right corner of your screen, that red box there: that's the door.
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
06 Jul 2016 02:28 PM
local Message = ":m hello there!"
local MessageContent = {}
for Word in string.gmatch(Message, "%S+") do
table.insert(MessageContent, Word)
end

if MessageContent[1] == ":m" then
Message = ""
table.remove(MessageContent, 1)
for _, Words in pairs(MessageContent) do Message = Message .. Words .. " " end
end

print(Message)


-=[ RAP: 345,308 || DurstAuric; the narb of ROBLOX ]=-
Report Abuse
iDerpyDogez is not online. iDerpyDogez
Joined: 05 Feb 2012
Total Posts: 1781
06 Jul 2016 02:46 PM
i do

local message = {}
for i in string.gmatch(msg, "%w+") do
table.insert(message, i)
end

if the separator isnt a letter or a digit, the table will be {":command", "thingAfterFirstSpace", "thingAfterSecondSpace", "etc"}


#code while true do end
Report Abuse
BanTech is not online. BanTech
Joined: 31 Dec 2015
Total Posts: 886
06 Jul 2016 02:55 PM
Instead of
for _, Words in pairs(MessageContent) do Message = Message .. Words .. " " end
You could just do
Message = table.concat(MessageContent, ' ')
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
06 Jul 2016 02:59 PM
Oh yeah, I always forget about concat. I don't really like it though, as it applies an effect at the beginning.

Message = table.concat(MessageContent, ".")
print(Message)

Output:
.hello.there!


-=[ RAP: 345,710 || DurstAuric; the narb of ROBLOX ]=-
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
06 Jul 2016 03:02 PM
Oh wait, it doesn't. I probably used it wrong then. Yeah, concat is an easier way.


-=[ RAP: 345,821 || DurstAuric; the narb of ROBLOX ]=-
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