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: Why do scripts still run when they are removed?

Previous Thread :: Next Thread 
xSIXxBasicPlayer is not online. xSIXxBasicPlayer
Joined: 07 Nov 2010
Total Posts: 26
17 Apr 2012 11:25 AM
script.Parent = nil

while true do
print("lol")
wait()
end

-- still prints "lol" repeatedly.



fix it plz.
Report Abuse
Sorcus is not online. Sorcus
Forum Moderator
Joined: 29 Nov 2010
Total Posts: 3775
17 Apr 2012 12:00 PM
Even with a wait the script still doesn't get booted? This is new.

~Sorcus
Report Abuse
rossb654mail is not online. rossb654mail
Joined: 12 Oct 2009
Total Posts: 11004
17 Apr 2012 12:54 PM
Yeah Sorcus, yet another flaw to roblox.
Oh, and unban rossb654, please. :)
Report Abuse
Oysi93Creator2 is not online. Oysi93Creator2
Joined: 20 Dec 2009
Total Posts: 165
17 Apr 2012 01:01 PM
"Even with a wait the script still doesn't get booted? This is new."

I remember doing this in script builders in '09, to never have my script removed...
Report Abuse
TheMyrco is not online. TheMyrco
Joined: 13 Aug 2011
Total Posts: 15105
17 Apr 2012 01:09 PM
It is because you remove it incorrectly.
Report Abuse
rossb654mail is not online. rossb654mail
Joined: 12 Oct 2009
Total Posts: 11004
17 Apr 2012 01:10 PM
..There's only two ways to remove a script.. By using another script or deleting it from the Workspace.
What you could do is disable the script first then delete it afterwards.
Report Abuse
Tenal is not online. Tenal
Joined: 15 May 2011
Total Posts: 18684
17 Apr 2012 01:15 PM
Does the script work by creating a thread that is not affected by the existence of the script once executed?
Report Abuse
rossb654mail is not online. rossb654mail
Joined: 12 Oct 2009
Total Posts: 11004
17 Apr 2012 01:18 PM
I'm quite a newbie to more complicated scripting, but why is script.Parent = nil necessary?
Report Abuse
Oysi93Creator2 is not online. Oysi93Creator2
Joined: 20 Dec 2009
Total Posts: 165
17 Apr 2012 01:22 PM
"It is because you remove it incorrectly."

No matter how you remove it, as long as the removal is done by the script itself, the script will continue running. The only other option is to make it error through, what would be wisest, the error function. Or to just return, outside of any function. It will stop it without having an extra error message, which is nice.
Report Abuse
xSIXxBasicPlayer is not online. xSIXxBasicPlayer
Joined: 07 Nov 2010
Total Posts: 26
17 Apr 2012 01:44 PM
@TheM

So? Try :Remove() or :Destroy(), it still runs.

@Sorcus

ogm hai.

@ross

no, unban xSIXx instead.
Report Abuse
rossb654mail is not online. rossb654mail
Joined: 12 Oct 2009
Total Posts: 11004
17 Apr 2012 02:05 PM
If xSIXx is terminated, then unban both of them
If it's just a timed ban, then SHADDAP
Report Abuse
xSIXxBasicPlayer is not online. xSIXxBasicPlayer
Joined: 07 Nov 2010
Total Posts: 26
17 Apr 2012 02:06 PM
terminated.
Report Abuse
TheMyrco is not online. TheMyrco
Joined: 13 Aug 2011
Total Posts: 15105
17 Apr 2012 02:12 PM
That is because the code is first progressed to the C side and then ASM, a Script is just an object desgined to contain code.
If it runs once, and it gets removed - it wil lstill do its thing(s), because it's just an object.

Imagine it this way:
You have string object with source (script object).
Script reads string objext, stores it, executes it (C(++)-side).

It will keep 'running'.
Report Abuse
Oysi93Creator2 is not online. Oysi93Creator2
Joined: 20 Dec 2009
Total Posts: 165
17 Apr 2012 02:23 PM
I was looking forward to you saying something like that. Because now you're gonna explain why removing a script with another script, stops it completely. Also, in case you hadn't noticed, I was answering your "removing incorrectly" thingy.
Report Abuse
TheMyrco is not online. TheMyrco
Joined: 13 Aug 2011
Total Posts: 15105
17 Apr 2012 02:26 PM
@oysi: I didn't think when I posted that :P
Report Abuse
Maradar is not online. Maradar
Joined: 06 Mar 2012
Total Posts: 4478
17 Apr 2012 02:27 PM
print("lol")
wait()
script:remove()
end
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
17 Apr 2012 02:28 PM
I think local scripts terminate when removed or destroyed.
Report Abuse
Oysi93Creator2 is not online. Oysi93Creator2
Joined: 20 Dec 2009
Total Posts: 165
17 Apr 2012 02:31 PM
@Quenty
Like I said, if you by any means remove a script by the script itself, the thread will continue to run. However, if you remove the script through another script, the script will get removed and the thread will stop running. It's doubtful localscripts act differently than normal scripts on this, seeing as in solo mode, localscripts are practically equal to normal scripts. I haven't tested though, but you probably were referring to what I just explained.
Report Abuse
tom17121 is not online. tom17121
Joined: 29 Dec 2010
Total Posts: 969
17 Apr 2012 02:43 PM
Think of Workspace as a Planet Earth everything inside

Think of Lighting as the Sky the times Ect:


Think of nil as a Invisible Gas but its still there and can be removed if you do it correctly
Report Abuse
TheMyrco is not online. TheMyrco
Joined: 13 Aug 2011
Total Posts: 15105
17 Apr 2012 03:04 PM
Think as of above's post never excisted.
Report Abuse
Oysi93Creator2 is not online. Oysi93Creator2
Joined: 20 Dec 2009
Total Posts: 165
17 Apr 2012 03:23 PM
Tom's trolling level: OVAR NINE THOUSAND!!!
Report Abuse
Techboy6601 is not online. Techboy6601
Joined: 29 Jun 2009
Total Posts: 4914
17 Apr 2012 03:24 PM
^x2

wh....wha..............

what?

*mindblown*

~Techboy6601: The IDE guy~
Report Abuse
TheMyrco is not online. TheMyrco
Joined: 13 Aug 2011
Total Posts: 15105
17 Apr 2012 03:27 PM
@Oysi: Iseewhatyoudidthere (ik zie wat je daar deed)

ನ್ನಡ
Report Abuse
HotThoth is not online. HotThoth
Forum Moderator
Joined: 24 Aug 2010
Total Posts: 1176
17 Apr 2012 03:39 PM
I really could've sworn that "script.Disabled script:Remove() wait()" used to disable the script as it's running... as long as there was a wait after the disable-remove to give the thread time to yield. Maybe it was behaving badly in 09, better in 10-11, and now is bad again? You're sure this isn't something that changed recently?

Report Abuse
Tenal is not online. Tenal
Joined: 15 May 2011
Total Posts: 18684
17 Apr 2012 03:40 PM
"script.Disabled script:Remove() wait()"
Eh, I think you're wrong; it wouldn't disable the script. n00b.

~Sorcus
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