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 » Scripting Helpers
Home Search
 

Re: Event connection question

Previous Thread :: Next Thread 
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
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 is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
29 Sep 2013 10:19 AM
Should do.
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
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
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
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
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
29 Sep 2013 10:39 AM
Workspace.ResourceRegen:9: bad argument #3 to 'Position' (Vector3 expected, got nil)

wat
Report Abuse
Desperian is not online. 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
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
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 is not online. 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
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
29 Sep 2013 10:44 AM
Now it's giving me a red line.
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
29 Sep 2013 10:45 AM
grrrrr I keep late posting
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
29 Sep 2013 10:45 AM
Thanks!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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