Im trying to make the nuke constantly expand itself, but stop at the Vector3 Size 30,30,30 however it show me the error. Here's the script:
01 | nuke = script.Parent |
02 | pos = nuke.CFrame |
03 | wait( 10 ) |
04 | nuke.Transparency = 0.4 |
05 | nuke.CanCollide = false |
06 | while wait() do |
07 | nuke.Size = nuke.Size + Vector 3. new ( 0.9 , 0.9 , 0.9 ) |
08 | nuke.CFrame = pos |
09 | end |
10 |
11 |
12 | if |
13 | nuke.Size.Vector 3 = ( 30 , 30 , 30 ) |
14 | then |
15 | nuke:remove() |
16 | end |
17 | end |
Well, your whole script is a mess (No offense), but there are a few points that are correct. First off, instead of constantly adding a Vector3
to the current size, and having it stop at Vector3.new(30,30,30)
, you could just use a for loop. Like this:
01 | local Nuke = script.Parent |
02 | local Pos = Nuke.CFrame |
03 | wait( 10 ) |
04 | Nuke.Transparency = 0.4 |
05 | Nuke.CanCollide = false |
06 | for i = 1 , 30 , 0.9 do --1 is the start, 30 is the end, and 0.9 is the interval |
07 | Nuke.Size = Vector 3. new(i,i,i) |
08 | Nuke.CFrame = Pos |
09 | wait() |
10 | end |
11 | Nuke:Destroy() --Use destroy instead of remove because it causes less lag |
Hope this helped!