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: Array help

Previous Thread :: Next Thread 
murigun is not online. murigun
Joined: 11 Jan 2009
Total Posts: 433
19 Jan 2013 01:16 PM
I'm making a script that checks if a tree has fallen under a model. What I can't figure out is how to find index of value that is changed within the hits array. Since the function treehit is called upon a change in the array. All I want to know is how do I tell the program to bring up the value that has changed in the array.

If you can help me, Thank you so much.

local hits = {}
local trees = script.Parent.Trees:GetChildren() --Path is correct
for i = 1, #trees do
hits[i] = trees[i].hit.Value
end
function treehit()
for i = 1, #trees do
hits[i] = trees[i].hit.Value
end
end

hits.Changed:connect(treehit)
Report Abuse
murigun is not online. murigun
Joined: 11 Jan 2009
Total Posts: 433
19 Jan 2013 01:45 PM
Bump. Anyone?
Report Abuse
murigun is not online. murigun
Joined: 11 Jan 2009
Total Posts: 433
19 Jan 2013 02:06 PM
Bump...
Report Abuse
sting4672 is not online. sting4672
Joined: 29 Oct 2009
Total Posts: 1396
19 Jan 2013 02:08 PM
Don't no.
Report Abuse
murigun is not online. murigun
Joined: 11 Jan 2009
Total Posts: 433
19 Jan 2013 02:17 PM
I mean, the real question is, Can i detect a change in a specific value of an array?
Report Abuse
murigun is not online. murigun
Joined: 11 Jan 2009
Total Posts: 433
19 Jan 2013 03:53 PM
Bump....
Report Abuse
murigun is not online. murigun
Joined: 11 Jan 2009
Total Posts: 433
19 Jan 2013 07:43 PM
Does anybody know?
Report Abuse
StygianBlade is not online. StygianBlade
Joined: 15 Sep 2011
Total Posts: 426
19 Jan 2013 08:05 PM
I think you mean to make treehit run when a child in trees gets changed?

function treehit()
for i = 1, #trees do
hits[i] = trees[i].hit.Value
end
end

for _, tree in ipairs(script.Parent.Trees:GetChildren()) do
tree.hit.Value.Changed:connect(treehit)
end
Report Abuse
murigun is not online. murigun
Joined: 11 Jan 2009
Total Posts: 433
21 Jan 2013 04:12 PM
Oh, thanks. That works, but I already fixed it. Thanks a lot though!
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