Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I fix a tool's part spawner so it could be removed after a few seconds?

Asked by
Jxemes 75
6 years ago

Let's say that I have a tool, and the tool spawns "ToolSpawnedParts" that will be placed on the ground. I made a seperate script that is supposed to be in Workspace. It's supposed to clean up all "ToolSpawnedParts" in Workspace, but it doesn't work. It doesn't say anything in the output, I tried functions, waits, and changed. Can anyone help?

function toolCleanup()
    wait(8)
    workspace:FindChildren("ToolSpawnedParts")
    workspace.ToolSpawnedParts:remove()
end

workspace:connect(toolCleanup)
2
Lets begin with your first issue. FindChildren does not exist. Do GetChildren instead. Second issue, :remove() is deprecated. Use Destroy() instead. Last issue, :connect is deprecated. Use :Connect instead. Keep in mind that these are basic issues and I have not solved your issue directly. Here is the wiki to GetChildren. http://wiki.roblox.com/index.php?title=API:Class/Instance/GetChildren AdvancedCode 136 — 6y
0
@AdvanceCode Awesome! I'll do the rest by myself, but thanks for the help. Jxemes 75 — 6y
0
I forgot the colon in front of Destroy(). It should be :Destroy() AdvancedCode 136 — 6y
0
Stop sperging out over :connect. cabbler 1942 — 6y

Answer this question