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: How do I make a script remove itself? I failed at it :|

Previous Thread :: Next Thread 
M1sterR0b0t is not online. M1sterR0b0t
Joined: 10 Nov 2014
Total Posts: 65
27 Mar 2017 05:29 PM
So I got like this weird radio thing that has a song playing on default, and then when it's done it plays a static sound. The thing is, after the static plays after the certain amount of time, the script pretty much restarts it's stuff and after the amount of time passes again it plays the sound again overlapping with the other one. Pretty much, it's loud as hell, so I tried to make the script remove it's self after a certain amount of time. Since I'm typing here, you already know it didn't work. Any help?

sound = script.Parent.Sound

while true do
wait(161)
sound:Play()
end

while true do
wait(162)
script:remove()
end

I am ready to get roasted by literal script kitties.
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
27 Mar 2017 05:29 PM
:destroy()
Report Abuse
M1sterR0b0t is not online. M1sterR0b0t
Joined: 10 Nov 2014
Total Posts: 65
27 Mar 2017 05:31 PM
Alright, thanks.
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
27 Mar 2017 05:34 PM
all remove does is

self.Parent = nil
for _, child in ipairs( self:getChildren() ) do
child:remove()
end
Report Abuse
pspshade is not online. pspshade
Joined: 29 Apr 2012
Total Posts: 2162
27 Mar 2017 05:34 PM
you didnt specify what "script" is


There once was a boy named Harry, destined to be a star. His parents were killed by Voldemort, who gave him a lightning scar.
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
27 Mar 2017 05:34 PM
destroy gets rid of connections, stops the things inside, and locks the parent
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
27 Mar 2017 05:35 PM
######### ...
Report Abuse
M1sterR0b0t is not online. M1sterR0b0t
Joined: 10 Nov 2014
Total Posts: 65
27 Mar 2017 05:38 PM
From my knowledge it's not required to specify it, since if you look at, for example, "script.Parent", it just seems to know you're talking about the parent of the script you're typing, so I assume it would work without the .Parent. I may be wrong..
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
27 Mar 2017 05:39 PM
no hes just dumb script is a global variable in roblox representing the script object containing the code
Report Abuse
M1sterR0b0t is not online. M1sterR0b0t
Joined: 10 Nov 2014
Total Posts: 65
27 Mar 2017 05:39 PM
wait I do have to specify it, thanks!
Report Abuse
M1sterR0b0t is not online. M1sterR0b0t
Joined: 10 Nov 2014
Total Posts: 65
27 Mar 2017 05:41 PM
Well it didn't work, so it's worth a try, I guess
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