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: A problem that Is driving me nuts

Previous Thread :: Next Thread 
yoyoman2 is not online. yoyoman2
Joined: 07 Mar 2009
Total Posts: 2170
06 May 2013 04:28 AM
function _G.LoadPart(ObjectValue,Model)
local Part = ObjectValue.Value:clone()
if Model ~= nil then
Part.Parent = Model
else
Part.Parent = Workspace
end
end

function _G.UnLoadPart(Part,Model)
local ObjectValue = Instance.new("ObjectValue")
ObjectValue.Value = Part
if Model ~= nil then
ObjectValue.Parent = Model
else
ObjectValue.Parent = Workspace
end
Part:Destroy() --The Problem Comes here
end


for some reason, The ObjectValue.Value becomes nil when the original part is destroyed.

as seen here:
http://www.roblox.com/Forum/ShowPost.aspx?PostID=96906583

I dont think the advanced scripters that have more expirience with the RBX system are there right now.

So I came here, I dont need a script fix, just an explanation why it is like that.
Report Abuse
NINJAKID09 is not online. NINJAKID09
Joined: 27 Aug 2009
Total Posts: 14392
06 May 2013 04:34 AM
http://wiki.roblox.com/index.php/Destroy

It might help to read more about the Instance::Destroy method, considering it's a one way method for getting rid of objects from ROBLOX.

Once an object is destroyed, you can't use it again.
Report Abuse
yoyoman2 is not online. yoyoman2
Joined: 07 Mar 2009
Total Posts: 2170
06 May 2013 04:36 AM
I had that theory, Didnt check it because someone told me it did not destroy connections as well, thanks anyways!
Report Abuse
yoyoman2 is not online. yoyoman2
Joined: 07 Mar 2009
Total Posts: 2170
06 May 2013 04:39 AM
wait, then what function can I use? or rather say, Should I use?
Report Abuse
NINJAKID09 is not online. NINJAKID09
Joined: 27 Aug 2009
Total Posts: 14392
06 May 2013 04:41 AM
I'm not sure if using .Parent = nil will allow you to keep the object stored in an ObjectValue, but you could try that.
Report Abuse
yoyoman2 is not online. yoyoman2
Joined: 07 Mar 2009
Total Posts: 2170
06 May 2013 04:43 AM
Does not work, well im off telling telamon a few words of advice on twitter then.
Report Abuse
NINJAKID09 is not online. NINJAKID09
Joined: 27 Aug 2009
Total Posts: 14392
06 May 2013 04:46 AM
I'm curious as to why you don't just store the said part in a global variable for later use? That way if you want to "Load" it you just clone it and then destroy the clone when appropriate.

Much easier than trying to store it in an ObjectValue.
Report Abuse
yoyoman2 is not online. yoyoman2
Joined: 07 Mar 2009
Total Posts: 2170
06 May 2013 04:51 AM
I want to make a chunk system, I want to see if I could get roblox to preety much remember millions of parts and loading the correct chunk of them if i want.

I cant predict what my chunks will have, also it would take me literal 100's of years to write down so much code so it will make a chunks system. since most parts will be unloaded most of the time, I wont be able to reassign new data to a small number of global variable's.

thats all I can do with my scripting knowledge of RBX.Lua
Report Abuse
NINJAKID09 is not online. NINJAKID09
Joined: 27 Aug 2009
Total Posts: 14392
06 May 2013 04:55 AM
That's where tables come in handy, mate. c:
Report Abuse
yoyoman2 is not online. yoyoman2
Joined: 07 Mar 2009
Total Posts: 2170
06 May 2013 04:58 AM
i guess, tell me mate.

can tables hold object values?
Report Abuse
toshir0z is not online. toshir0z
Joined: 03 Nov 2009
Total Posts: 425
06 May 2013 09:15 AM
@yoyoman2 Yes tables can hold Objects. They can even Store sub-tables.
Report Abuse
woot3 is not online. woot3
Joined: 10 Nov 2008
Total Posts: 3599
06 May 2013 03:52 PM
Don't tables have a limit though? Or am I mad?? Well, I am mad. That's been proven.
Must of been a thread I read a while ago or something.

Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
06 May 2013 04:46 PM
Yes they do. The amount of memory you have.

ololol jk
It's something like a massive massive number.
Report Abuse
Aerideyn is not online. Aerideyn
Joined: 16 Jan 2010
Total Posts: 1882
06 May 2013 10:16 PM
Yeah store them in a table, you could reference tens of thousands of chunks before you would end up with any memory issues.
Report Abuse
woot3 is not online. woot3
Joined: 10 Nov 2008
Total Posts: 3599
07 May 2013 01:13 AM
I find running calculations for chunk loading every 10 seconds or so is still pretty taxing. I often partition my maps, I find it works very effectively.
Report Abuse
yoyoman2 is not online. yoyoman2
Joined: 07 Mar 2009
Total Posts: 2170
07 May 2013 02:00 AM
the interesting thing about chunk loading in roblox is that the bigger each is, it takes more parts in.

but, it can in theory also make a much larger game, as long as you find the ratio of player lag and stuff.

Ill experiment with it today, i think 50*50 chunks are a good value, if you load 9 at a time.
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