Need help again

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to achieve that a script will destroy its model and itself after 5 secs
  2. What is the issue? Include screenshots / videos if possible!
    well turns out the issue is that after 5 secs of waiting, it hasn’t disappeared
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I think that’s the only solution I have so far since this code is very short and easily understandable by a non experienced scripter
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
wait(5) 
script.Parent.kenk:Destroy() -- This should disappear
script:Destroy() -- And this should also disappear
print("success!") -- this should be the output when I run the code for 5 secs
--RESULT: Nothing.. The script is still there with the model "kenk"

Make sure the Script isn’t disabled, and in the output, look for success without a colored bar to its left. To demonstrate, I did this with a LocalScript, destroying the character.
image
You can see “success!” with no color highlight, so do make sure it prints something.

Yes it isnt disabled and I put the script in the ServerStorage with the Model “kenk” in the serverstorage too

That’s probably your issue. Objects in ServerStorage, including scripts, cannot do anything until in the workspace or ServerScriptService.

is it a local script or a server script?

I think because you deleted the model itself, and there is no more script. So it wont pass the next line and wont print “success”.

It’s a normal script and its not client sided

I put script and “kenk” As a children in the ServerStorage there

Quoting what I said earlier:

Objects in ServerStorage, including scripts, cannot do anything until in the workspace or ServerScriptService.

If you wanna do it I think you should do it on the serverscriptservice, so that the script wont disappear too

I believe the script being destroyed is intended, also, destroying the model and then the Parent works completely fine as seen by my example in reply 1.

The best way to do it is cloning the object from replicatedstorage/serverstorage and Destroy them

Alright, I’ve put the script in the ServerScriptService and changed some code:

–wait(5)
game.ServerStorage.kenk:Destroy()
script:Destroy()
print(“success!”)

This should work fine, although I don’t understand why you are destroying the script?

Well turned out it worked for some reason…

Ah I wanna clear it out empty… hehe

Well, I’m extremely confused on why you are doing this in the first place? You can skip the script and just remove all junk, or “kenk” from ServerStorage.
gouQwMj1SQ

Sorry for wasting your time (and probably mine too) but thanks I just wanna know if scripts work in all Game children…

Scripts only work in about 7 places:
Workspace,
ReplicatedFirst,
ServerScriptService,
StarterGui,
StarterPack,
StarterCharacterScripts,
and finally,
StarterPlayerScripts.

There may be more, like SoundService, but I haven’t tried before.

Thanks very much, I hope you’re fine with after all I babbled about back above,
sorry for wasting your time and other people above

1 Like