spunjebab
|
  |
| Joined: 17 Oct 2015 |
| Total Posts: 303 |
|
|
| 01 Jan 2016 05:54 PM |
How would I turn "0, 0, 0" into Vector3.new(0, 0, 0)
assuming I don't know that "0, 0, 0" is exactly "0, 0, 0" relative to things such as the length of the string, etc |
|
|
| Report Abuse |
|
|
| |
|
spunjebab
|
  |
| Joined: 17 Oct 2015 |
| Total Posts: 303 |
|
| |
|
|
| 01 Jan 2016 06:04 PM |
I can get you the first coordinate
local x = stng:match("%d+") |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2016 06:06 PM |
print(string.match("0,0,0","%d+%,%d+%,%d+"))
AH HA
I was able to turn a string, into a string.. |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2016 06:07 PM |
| print(Vector3.new("0, 0, 0")) |
|
|
| Report Abuse |
|
|
spunjebab
|
  |
| Joined: 17 Oct 2015 |
| Total Posts: 303 |
|
|
| 01 Jan 2016 06:07 PM |
"print(Vector3.new("0, 0, 0"))"
gtfo |
|
|
| Report Abuse |
|
|
spunjebab
|
  |
| Joined: 17 Oct 2015 |
| Total Posts: 303 |
|
|
| 01 Jan 2016 06:09 PM |
@joey
that's still a string though |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2016 06:10 PM |
local x = stng:match("%d+") stng = stng:sub(#x,#stng) local y = stng:match("%d+") stng = stng:sub(#y,#stng) local z = stng:match("%d+") local vector = Vector3.new(tonumber(x),tonumber(y),tonumber(z)) |
|
|
| Report Abuse |
|
|
nox7
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 27467 |
|
|
| 01 Jan 2016 06:10 PM |
local Coords = "0, 0, 0" local X,Y,Z = Coords:match("^%s*([%d%.]-)%s*,%s*([%d%.]-)%s*,%s*([%d%.]-)%s*$") print(X,Y,Z)
Also gets decimal numbers. |
|
|
| Report Abuse |
|
|
| |
|
nox7
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 27467 |
|
|
| 01 Jan 2016 06:11 PM |
And if you want to turn it into Vector3:
local V3 = (tonumber(X), tonumber(Y), tonumber(Z)) |
|
|
| Report Abuse |
|
|
spunjebab
|
  |
| Joined: 17 Oct 2015 |
| Total Posts: 303 |
|
|
| 01 Jan 2016 06:12 PM |
"Try it before you judge, idiot."
leave you're not smart |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2016 06:12 PM |
local function StringToVector3(str) local x, y, z = string.match(str, "(.+), (.+), (.+)") return Vector3.new(tonumber(x), tonumber(y), tonumber(z)) end
/Domingo en fuego/ |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2016 06:18 PM |
lol says the one who can't script
local Table = {} local String = "10, 10, 9"
for v in string.gmatch(String, "%d+") do table.insert(Table, v) end
game.Workspace.Part.Position = Vector3.new(Table[1], Table[2], Table[3]) |
|
|
| Report Abuse |
|
|
spunjebab
|
  |
| Joined: 17 Oct 2015 |
| Total Posts: 303 |
|
|
| 01 Jan 2016 06:20 PM |
"local Table = {} local String = "10, 10, 9"
for v in string.gmatch(String, "%d+") do table.insert(Table, v) end
game.Workspace.Part.Position = Vector3.new(Table[1], Table[2], Table[3])"
yeah sure keep talking urself up no one cares ur not smart question was answered, put ur ego away and gtfo |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2016 06:23 PM |
| lol im smarter than u 8 year old noob |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2016 06:24 PM |
i made similar one to dermon, so i made a different one
im here to help you, you're not here to help me lol |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2016 06:43 PM |
idk why but here:
local String = "10, 10, 9" game.Workspace.Part.Position = Vector3.new(string.match(String, "(%d+), (%d+), (%d+)")) |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2016 07:48 PM |
| vector3.new(tonumber('1'), tonumber('1'),tonumber('1')) |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2016 07:52 PM |
Why are you guys using complicated string stuff? ROBLOX automatically lets strings be used as numbers when possible:
local vec = "0, 0, 0" local v3 = Vector3.new(vec) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
chimmmihc
|
  |
| Joined: 24 Jul 2014 |
| Total Posts: 2420 |
|
| |
|
|
| 01 Jan 2016 09:05 PM |
| who tf are you talking about fish |
|
|
| Report Abuse |
|
|