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: String manipulation

Previous Thread :: Next Thread 
beeswithstingerss is not online. beeswithstingerss
Joined: 17 Mar 2013
Total Posts: 18
04 Nov 2017 09:26 PM
I was creating a teleport script so when someone typed in a text box something specific, it tps them. My thought process was that I could be looking in between the 1st space and the 2nd one would be one name. In between the end and the 2nd space would be the second person. I managed to get around that but I had the same problem again. I know string.match should have what I am looking for but I don't know how to code how to detect the space or what parameters are needed. It would be even better if you explained what each one did. (s, pattern [, init])
Report Abuse
tanlord173 is not online. tanlord173
Joined: 25 Nov 2009
Total Posts: 3916
04 Nov 2017 09:27 PM
Show the script so we (Scripters) can see.
Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
04 Nov 2017 09:28 PM
scrippas*
Report Abuse
kylerzong is not online. kylerzong
Joined: 06 Aug 2011
Total Posts: 659
04 Nov 2017 09:30 PM
paystebin com/M0zY5h8j

local string = "player1 player2"


local words = module:parse(" ",string)


print(words[1])
print(words[2])

Output:
player1
player2
Report Abuse
beeswithstingerss is not online. beeswithstingerss
Joined: 17 Mar 2013
Total Posts: 18
04 Nov 2017 09:34 PM
Not much more to see besides what I said but here it is:

if script.Parent.Click.TextBox.Text:sub(1, 4) == "warn" then
local TargetPlayer = game:GetService("Players").Players:FindFirstChild(script.Parent.Click.TextBox.Text:sub(4))
if TargetPlayer then
TargetPlayer.StarterGui.Warning.Text =
TargetPlayer.StarterGui.Warning.Visible = true
wait(2.5)
TargetPlayer.StarterGui.Warning.Visible = false
end
end

I am just trying to figure out how to allow someone to give a reason for the warning, then put it into the text value
Report Abuse
tanlord173 is not online. tanlord173
Joined: 25 Nov 2009
Total Posts: 3916
04 Nov 2017 09:53 PM
Oh, you want to do something like that?

local reason = "Life"

function WarnExample()
print("You have been warned. Reason: " .. reason)
end
Report Abuse
beeswithstingerss is not online. beeswithstingerss
Joined: 17 Mar 2013
Total Posts: 18
04 Nov 2017 10:02 PM
Yes but that is not my problem I was encountering. So I have someone click on a gui, enter the command, but with this command, I need to somehow separate the person and the reason. So back to the idea of finding the spaces!
Report Abuse
soutenu is online. soutenu
Joined: 09 Dec 2011
Total Posts: 1021
04 Nov 2017 10:04 PM
local str = 'Player1 player_2';

for p in str:gmatch'%w+%_*%w*' do
print(p);
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