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 » Scripting Helpers
Home Search
 

Re: Help with string.sub(msg, 6, the rest of the letters in the chat)

Previous Thread :: Next Thread 
iguana72 is not online. iguana72
Joined: 21 Feb 2008
Total Posts: 3196
12 Oct 2009 03:50 PM
How would I find every letter after letter number 5?

string.sub(msg, 6, ????)
Report Abuse
iguana72 is not online. iguana72
Joined: 21 Feb 2008
Total Posts: 3196
12 Oct 2009 03:58 PM
BAWMP my full script.

function onChat(msg, recipient, speaker)
if (string.sub(msg, 1, 5)=="kill/") then
string.sub(msg, 6, )
end
end

game.Players.iguana72.Chatted:connect(onChat)
Report Abuse
yoho191 is not online. yoho191
Joined: 21 Apr 2007
Total Posts: 95
12 Oct 2009 04:20 PM
function onChat(msg, recipient, speaker)
if (string.sub(msg, 1, 5)=="kill/") then
string.sub(msg, 6)
end
end

game.Players.iguana72.Chatted:connect(onChat)


you do not need a comma if you want all the letters after the first number
string.sub(msg,6) is all the letters from 6 and on
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
12 Oct 2009 04:21 PM
Because the third argument in string.sub() is always -1 (when you didn't change it), you don't need to put in any 3rd argument.
Report Abuse
iguana72 is not online. iguana72
Joined: 21 Feb 2008
Total Posts: 3196
12 Oct 2009 04:27 PM
Ok thanks blocco and (I forgot your name)! :D
Report Abuse
iguana72 is not online. iguana72
Joined: 21 Feb 2008
Total Posts: 3196
12 Oct 2009 04:30 PM
Dang it won't work... :|


function onChat(msg, recipient, speaker)
if (string.sub(string.lower(msg),1,5) == "kill/") then
ick = string.sub(msg,6)
local c = game.Players:GetChildren()
for i=1,#c do
h = c[i]
if string.find(string.lower(h.Name),string.lower(ick)) == 1 then
if h.className == "Player" then
h2 = h.Character:FindFirstChild("Humanoid")
if h2 ~= nil then
h2.Health = 0
end
end
end
end
end
if (string.sub(string.lower(msg),1,7) == "killall") then
local c = game.Players:GetChildren()
for i=1,#c do
c[i].Character.Humanoid.Health = 0
end
end
if (string.sub(string.lower(msg),1,10) == "invisible/") then
ick = string.sub(msg,11)
local c = game.Players:GetChildren()
for i=1,#c do
h = c[i]
if string.find(string.lower(h.Name),string.lower(ick)) == 1 then
if h.className == "Player" then
h2 = h.Character:FindFirstChild("Humanoid")
if h2 ~= nil then
if (h.Character:FindFirstChild("Left Leg") ~= nil) then
h.Character["Left Leg"].Transparency = 1
end
if (h.Character:FindFirstChild("Left Arm") ~= nil) then
h.Character["Left Arm"].Transparency = 1
end
if (h.Character:FindFirstChild("Right Leg") ~= nil) then
h.Character["Right Leg"].Transparency = 1
end
if (h.Character:FindFirstChild("Right Arm") ~= nil) then
h.Character["Right Arm"].Transparency = 1
end
if (h.Character:FindFirstChild("Torso") ~= nil) then
h.Character["Torso"].Transparency = 1
end
if (h.Character:FindFirstChild("Head") ~= nil) then
h.Character["Head"].Transparency = 1
end
end
end
end
end
end
if (string.sub(string.lower(msg),1,8) == "visible/") then
ick = string.sub(msg,9)
local c = game.Players:GetChildren()
for i=1,#c do
h = c[i]
if string.find(string.lower(h.Name),string.lower(ick)) == 1 then
if h.className == "Player" then
h2 = h.Character:FindFirstChild("Humanoid")
if h2 ~= nil then
if (h.Character:FindFirstChild("Left Leg") ~= nil) then
h.Character["Left Leg"].Transparency = 0
end
if (h.Character:FindFirstChild("Left Arm") ~= nil) then
h.Character["Left Arm"].Transparency = 0
end
if (h.Character:FindFirstChild("Right Leg") ~= nil) then
h.Character["Right Leg"].Transparency = 0
end
if (h.Character:FindFirstChild("Right Arm") ~= nil) then
h.Character["Right Arm"].Transparency = 0
end
if (h.Character:FindFirstChild("Torso") ~= nil) then
h.Character["Torso"].Transparency = 0
end
if (h.Character:FindFirstChild("Head") ~= nil) then
h.Character["Head"].Transparency = 0
end
end
end
end
end
end
if (string.sub(string.lower(msg),1,5) == "fast/") then
ick = string.sub(msg,6)
local c = game.Players:GetChildren()
for i=1,#c do
h = c[i]
if string.find(string.lower(h.Name),string.lower(ick)) == 1 then
if h.className == "Player" then
h2 = h.Character:FindFirstChild("Humanoid")
if h2 ~= nil then
h2.WalkSpeed = 80
end
end
end
end
end
if (string.sub(string.lower(msg),1,5) == "slow/") then
ick = string.sub(msg,6)
local c = game.Players:GetChildren()
for i=1,#c do
h = c[i]
if string.find(string.lower(h.Name),string.lower(ick)) == 1 then
if h.className == "Player" then
h2 = h.Character:FindFirstChild("Humanoid")
if h2 ~= nil then
h2.WalkSpeed = 8
end
end
end
end
end
if (string.sub(string.lower(msg),1,7) == "normal/") then
ick = string.sub(msg,8)
local c = game.Players:GetChildren()
for i=1,#c do
h = c[i]
if string.find(string.lower(h.Name),string.lower(ick)) == 1 then
if h.className == "Player" then
h2 = h.Character:FindFirstChild("Humanoid")
if h2 ~= nil then
h2.WalkSpeed = 16
end
end
end
end
end
if (string.sub(string.lower(msg),1,4) == "god/") then
ick = string.sub(msg,5)
local c = game.Players:GetChildren()
for i=1,#c do
h = c[i]
if string.find(string.lower(h.Name),string.lower(ick)) == 1 then
if h.className == "Player" then
h2 = h.Character:FindFirstChild("Humanoid")
if h2 ~= nil then
h2.MaxHealth = 0
h2.WalkSpeed = 20
if (h.Character:FindFirstChild("Left Leg") ~= nil) then
h.Character["Left Leg"].Reflectance = 1
end
if (h.Character:FindFirstChild("Left Arm") ~= nil) then
h.Character["Left Arm"].Reflectance = 1
end
if (h.Character:FindFirstChild("Right Leg") ~= nil) then
h.Character["Right Leg"].Reflectance = 1
end
if (h.Character:FindFirstChild("Right Arm") ~= nil) then
h.Character["Right Arm"].Reflectance = 1
end
if (h.Character:FindFirstChild("Torso") ~= nil) then
h.Character["Torso"].Reflectance = 1
end
if (h.Character:FindFirstChild("Head") ~= nil) then
h.Character["Head"].Reflectance = 1
end
end
end
end
end
end
if (string.sub(string.lower(msg),1,6) == "ungod/") then
ick = string.sub(msg,7)
local c = game.Players:GetChildren()
for i=1,#c do
h = c[i]
if string.find(string.lower(h.Name),string.lower(ick)) == 1 then
if h.className == "Player" then
h2 = h.Character:FindFirstChild("Humanoid")
if h2 ~= nil then
h2.MaxHealth = 100
h2.WalkSpeed = 16
if (h.Character:FindFirstChild("Left Leg") ~= nil) then
h.Character["Left Leg"].Reflectance = 0
end
if (h.Character:FindFirstChild("Left Arm") ~= nil) then
h.Character["Left Arm"].Reflectance = 0
end
if (h.Character:FindFirstChild("Right Leg") ~= nil) then
h.Character["Right Leg"].Reflectance = 0
end
if (h.Character:FindFirstChild("Right Arm") ~= nil) then
h.Character["Right Arm"].Reflectance = 0
end
if (h.Character:FindFirstChild("Torso") ~= nil) then
h.Character["Torso"].Reflectance = 0
end
if (h.Character:FindFirstChild("Head") ~= nil) then
h.Character["Head"].Reflectance = 0
end
end
end
end
end
end
if (string.sub(string.lower(msg),1,4) == "ban/") then
ick = string.sub(msg,5)
local c = game.Players:GetChildren()
for i=1,#c do
h = c[i]
if string.find(string.lower(h.Name),string.lower(ick)) == 1 then
if h.className == "Player" then
h2 = h.Character:FindFirstChild("Humanoid")
if h2 ~= nil then
h.Parent = nil
end
end
end
end
end
end

game.Players.iguana72.Chatted:connect(onChat)
Report Abuse
iguana72 is not online. iguana72
Joined: 21 Feb 2008
Total Posts: 3196
12 Oct 2009 04:36 PM
Any probloms with it? I can't find any.
Report Abuse
iguana72 is not online. iguana72
Joined: 21 Feb 2008
Total Posts: 3196
12 Oct 2009 04:41 PM
Bring
Up
My
Post


Please anybody?!
Report Abuse
iguana72 is not online. iguana72
Joined: 21 Feb 2008
Total Posts: 3196
12 Oct 2009 04:46 PM
BAWMP PLZ??!?!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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