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 to int?

Previous Thread :: Next Thread 
DatOneHaxor is not online. DatOneHaxor
Joined: 19 Apr 2015
Total Posts: 39
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
UnIikeable is not online. UnIikeable
Joined: 21 Jun 2014
Total Posts: 25
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
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
23 Feb 2016 07:38 PM
^ thats disgusting and inefficient just use string manipulation
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
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
128Gigabytes is online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
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
DatOneHaxor is not online. DatOneHaxor
Joined: 19 Apr 2015
Total Posts: 39
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
DatOneHaxor is not online. DatOneHaxor
Joined: 19 Apr 2015
Total Posts: 39
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 is not online. Egzekiel
Joined: 10 Jan 2011
Total Posts: 1079
27 Feb 2016 04:39 PM
Loadstring enabled=Making your game hacker heaven.


Report Abuse
128Gigabytes is online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
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
DatOneHaxor is not online. DatOneHaxor
Joined: 19 Apr 2015
Total Posts: 39
28 Feb 2016 09:52 AM
Doesn't require creating a function for EVERY type of value?
Report Abuse
DatOneHaxor is not online. DatOneHaxor
Joined: 19 Apr 2015
Total Posts: 39
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
128Gigabytes is online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
28 Feb 2016 10:44 AM
Theres not that many values, its completely worth it to not use loadstring.
Report Abuse
DatOneHaxor is not online. DatOneHaxor
Joined: 19 Apr 2015
Total Posts: 39
28 Feb 2016 12:55 PM
Why so?
Report Abuse
128Gigabytes is online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
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
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
28 Feb 2016 02:41 PM
im sure you could use string manipulation to match any kind of function call
Report Abuse
DatOneHaxor is not online. DatOneHaxor
Joined: 19 Apr 2015
Total Posts: 39
13 Mar 2016 08:08 AM
How would you convert it from a string to a acctual script
Report Abuse
DatOneHaxor is not online. DatOneHaxor
Joined: 19 Apr 2015
Total Posts: 39
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
Customality is not online. Customality
Joined: 11 Aug 2015
Total Posts: 590
13 Mar 2016 10:20 AM
x = "1"
y = tonumber(x)
Report Abuse
DatOneHaxor is not online. DatOneHaxor
Joined: 19 Apr 2015
Total Posts: 39
09 Jun 2016 09:53 AM
Doesn't Work
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