I'm testing out a simple script that I made myself, and I need help on it

This is what my script has:

1| wait(10)
2| workspace.test_part.Destroy()

All I want to know is how can I make this script destroy “test_part”. (which is one of the parts in the game)

Here’s a screenshot I took of the errors it gave me that I thought I could understand:

So, when using the Instance destroy, you need to use : instead of .

so here’s your script:


local TestPart = --Your test Part
wait(10)
TestPart:Destroy()

1 Like

Try

wait(10)
workspace.test_part:Destroy()

You used “.Destroy()” instead of “:Destroy()”

Simply, use this:

wait(10)
workspace.test_part:Destroy()

when you call a function you need to use : no .

Thanks all! I’m just going to make the first post the solution since they replied first.

Thanks!

For the sake of knowledge: this is per the colon passing self as the implicit first argument. If you were calling it with a dot, it would be workspace.test_part.Destroy(workspace.test_part). The colon gets rid of the need to write out the object twice so the method just gets called on itself. Destroy is a member of the Instance superclass.

Thanks a lot for explaining the difference between a peroid and a colon! Very very very appreciated by me! ^^