|
| 23 Feb 2016 07:00 PM |
if cmd:sub(1,9) == 'property>' then l = 0 for s in cmdtxt:sub(10):gmatch("%S+") do l = l + 1 if l == 1 then r = s else dir[r] = stringtoint(s) out(r .. " Has Been Set To " .. s) end end end
What I want the above script to do is change the property of a var called dir to something I choose. For example you could say "property>Size Vector3.new(1,1,1)" and it would change the size to 1,1,1 BUT! I need to convert "Vector3.new(1,1,1)" to Vector3.new(1,1,1) ~NOT A STRING
Is there any way possible I can do this without creating a function for each property type? |
|
|
| Report Abuse |
|
|
|
| 23 Feb 2016 07:37 PM |
loadstring("x = Vector3.new(1, 1, 1)")() print(x) --> 1, 1, 1
server-script only, LoadstringEnabled must be true
|
|
|
| Report Abuse |
|
|
|
| 23 Feb 2016 07:38 PM |
| ^ thats disgusting and inefficient just use string manipulation |
|
|
| Report Abuse |
|
|
|
| 23 Feb 2016 07:41 PM |
to expand on that u can do something like
if str:find("^Vector3%.new%(.-%)$") then local x, y, z = str:match("^Vector3%.new%((.-),(.-),(.-)%)$") x, y, z = tonumber(x), tonumber(y), tonumber(z) local vec = Vector3.new(x, y, z) end |
|
|
| Report Abuse |
|
|
|
| 23 Feb 2016 07:45 PM |
I would suggest staying away from loadstring.
local function v(input) local numbers, output = input:sub(13, -2), {} for x in (numbers:gmatch("%d+")) do table.insert(output, tonumber(x)) end return (Vector3.new(unpack(output))); end
print(v("Vector3.new(128, 256, 64)") == Vector3.new(128, 256, 64)) --[[> true]]
For what reason do you need to turn a string into a vector3? |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2016 01:53 PM |
| Fine with loadstring I just need something simple and if not simple please explain why and or how it works >.< I'm kinda new. |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2016 04:34 PM |
| Also I want this to work for ANY function not just Vector3.new like also UDim2 and CFrame |
|
|
| Report Abuse |
|
|
Egzekiel
|
  |
| Joined: 10 Jan 2011 |
| Total Posts: 1079 |
|
|
| 27 Feb 2016 04:39 PM |
Loadstring enabled=Making your game hacker heaven.
|
|
|
| Report Abuse |
|
|
|
| 28 Feb 2016 03:10 AM |
| If you want it to work for other types of values you will just have to check what value they asked for in the command before converting it. |
|
|
| Report Abuse |
|
|
|
| 28 Feb 2016 09:52 AM |
| Doesn't require creating a function for EVERY type of value? |
|
|
| Report Abuse |
|
|
|
| 28 Feb 2016 09:53 AM |
| It's not my game, http://www.roblox.com/games/20279777/Voidacitys-Script-Builder, and yes loadstring is true |
|
|
| Report Abuse |
|
|
|
| 28 Feb 2016 10:44 AM |
| Theres not that many values, its completely worth it to not use loadstring. |
|
|
| Report Abuse |
|
|
| |
|
|
| 28 Feb 2016 01:04 PM |
To keep people from doing this property>game.Players.PlayerName:kick()
They could basically run any script they want. Not to mention loadstring an exploiters best friend. Using it is stupid, like not using filteringEnabled. |
|
|
| Report Abuse |
|
|
|
| 28 Feb 2016 02:41 PM |
| im sure you could use string manipulation to match any kind of function call |
|
|
| Report Abuse |
|
|
|
| 13 Mar 2016 08:08 AM |
| How would you convert it from a string to a acctual script |
|
|
| Report Abuse |
|
|
|
| 13 Mar 2016 10:19 AM |
| Also i want this to work for function call, I ended up using loadstring because it worked out for what i needed but if you have a more effecient way msg me |
|
|
| Report Abuse |
|
|
| |
|
| |
|