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

How do to destroy instances?

Asked by 3 years ago

Ive tried to create a lag test game for roblox but im struggling to destroy once its been created, ive tried everything but it still wont work

Heres the code:

"wait(0.0000001) local LagPart1 = Instance.new("Part") LagPart1.BrickColor = BrickColor.new("Institutional white") LagPart1.Material = ("ForceField") LagPart1.Parent = game.Workspace LagPart1.Position = Vector3.new(12, 61.5, 5) LagPart1.Name = "LagParts" LagPart1.Size = Vector3.new(6,6,6)"

"Reset.MouseButton1Up:Connect(function() Reset1 = true workspace:WaitForChild(LagPart1):Destroy()

end)"

0
Feeding an instance to WaitForChild is your problem. WaitForChild only accepts strings as its first parameter. Replace the LagPart1 variable with "LagPart1" as a string instead. ScuffedAI 435 — 3y
0
still doesnt work 4KChanxxe 4 — 3y

1 answer

Log in to vote
0
Answered by
Xapelize 2658 Moderation Voter Community Moderator
3 years ago

If you really wants to wait for a zeptosecond or the minimum second, consider changing to wait(). It takes 0.0002 seconds (I'm not sure I heard someone say it is)

You can clone an model and store all the parts inside, when you want to destroy all, destroy the model. It will be easier and straightforward.

0
HOLD ON! PLEASE WAIT ATLEAST 0.15 SECONDS BEFORE CLONING ANOTHER INSTANCE / PART OR YOUR ROBLOX STUDIO WILL CRY FOR HELP Xapelize 2658 — 3y
Ad

Answer this question