|
| 27 May 2013 06:03 PM |
I dont understand why this doesn't work. It supposes to make a String Value starting with { having all of the script.Parent's children's properties and ending with }
but it just prints } and the string values ends being {{{... any ideas?
sp=script.Parent m="" derp=true while derp do c1=sp:GetChildren() for i = 1,#c1 do c=c1[i] if c~=script then m=m,"{",c.BrickColor,c.Anchored,c.Size,c.Position,c.CanCollide,"}" print(m) end end s=Instance.new("StringValue") s.Parent=sp s.Value=tostring(m) derp=false wait(1) end |
|
|
| Report Abuse |
|
|
nairod7
|
  |
| Joined: 26 Mar 2010 |
| Total Posts: 869 |
|
|
| 27 May 2013 06:08 PM |
string concatenation: ..
local variable1 = "hello" local variable2 = "world!" print( variable1..", "..variable2 )
> hello, world!
Also, BrickColor, Anchored, etc... are userdata values and not string values. Use the function tostring.
m = m.."{"..tostring(c.BrickColor)..", "..tostring(c.Anchored)..", "..tostring(c.Size)..", "..tostring(c.Position)..", "..tostring(c.CanCollide).."}"
Something like this. |
|
|
| Report Abuse |
|
|
|
| 27 May 2013 06:14 PM |
| userdata values or not, it does work i tried it in the command bar and it worked idk why... |
|
|
| Report Abuse |
|
|
| |
|