|
| 29 Sep 2013 10:14 AM |
Would this work? It connects all IntValues to the change function.
s = script.Parent function change(value) s[value.Name.."Amount"].Text = tostring(value.Value) end
for i, v in pairs(s:GetChildren()) do if v:IsA("IntValue") then v.Changed:connect(function() change(v) end) end end |
|
|
| Report Abuse |
|
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
| |
|
|
| 29 Sep 2013 10:36 AM |
Would this position "resource" to a random position found in ["Bronze"]?
resources = {"Bronze"} spawningpoints = { ["Bronze"] = Vector3.new(10,1,6),Vector3.new(-5,1,0),Vector3.new(5,1,0) } while wait(10) do for i = 1, #resources do local resource = game.Lighting[resources[i]]:Clone() resource.Parent = Workspace resource.Position = spawningpoints[resources[i][math.random(1,#resources[i])]] end end |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2013 10:38 AM |
Gotta change one thing, NOW tell me if I did it right:
resources = {"Bronze"} spawningpoints = { ["Bronze"] = Vector3.new(10,1,6),Vector3.new(-5,1,0),Vector3.new(5,1,0) } while wait(10) do for i = 1, #resources do local resource = game.Lighting[resources[i]]:Clone() resource.Parent = Workspace resource.Head.Position = spawningpoints[resources[i][math.random(1,#resources[i])]] end end |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2013 10:39 AM |
Workspace.ResourceRegen:9: bad argument #3 to 'Position' (Vector3 expected, got nil)
wat |
|
|
| Report Abuse |
|
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 29 Sep 2013 10:43 AM |
spawningpoints = { ["Bronze"] = {Vector3.new(10,1,6),Vector3.new(-5,1,0),Vector3.new(5,1,0)} } resource.Head.Position = spawningpoints[resources[i]][math.random(1,#spawningpoints[resources[i])]
|
|
|
| Report Abuse |
|
|
|
| 29 Sep 2013 10:43 AM |
It's this line that's giving me trouble:
resource.Head.Position = spawningpoints[tostring(resources[i])[math.random(1,#resources[i])]] |
|
|
| Report Abuse |
|
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 29 Sep 2013 10:44 AM |
spawningpoints[resources[i]][math.random(1,#spawningpoints[resources[i]])]
Correction to my post. |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2013 10:44 AM |
| Now it's giving me a red line. |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2013 10:45 AM |
| grrrrr I keep late posting |
|
|
| Report Abuse |
|
|
| |
|