Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I correctly code a system of unanchored parts?

So I’m making a rain system and I don’t know what’s wrong can someone help me?

while true do
   wait()
   local Raining = Instance.new”Part”
   Raining.Anchored = false
   Raining.Transparency = 0.5
   Raining.Position = Vector3.new0,15,0
   Raining.Size = Vector3.new0.6, 3, 0.6
end

1 answer

✓ Accepted answer

The problem is actually quite simple; you aren't parenting the instance to anything, which means that it ceases to exist in the observable parts of your game, although it will still exist inside the code.

In your case I think it'd be best if you were to contain the created objects inside the script object itself, this is useful for organizing but doesn't really serve any practical role. You can achieve this like so:

while true do
   wait()
   local Raining = Instance.new”Part”
   Raining.Anchored = false
   Raining.Transparency = 0.5
   Raining.Position = Vector3.new(0,15,0)
   Raining.Size = Vector3.new(0.6, 3, 0.6)
   Raining.Parent = script -- New line of code
end

1 comment

1

Why do I need a new code, and thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.