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

CFraming nuke works, but positioning doesn't, help please?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I want to make a nuke explode and shrink down to normal size again, will this work?

-- This will make the nuke explode and cool down. You can add more to it.
nuke = script.Parent
pos = nuke.CFrame
for i = 5,5,5 do
repeat
nuke.Size = nuke.Size + Vector3(i)
nuke.CFrame = pos
until Nuke.Size.X >= 100
if nuke.Size.X>=100 then
repeat
nuke.Size = nuke.Size - Vector3(i)
until nuke.Size.X <=1
end 

1 answer

Log in to vote
0
Answered by
Ekkoh 635 Moderation Voter
10 years ago

Your for loop won't run because i is initialized at 5 so it doesn't need to do anything to get to 5. for loops go like so-

for index = start_value, end_value, increment do

By the looks of it you're trying to do something like this-

nuke = script.Parent
pos = nuke.CFrame

function boom() -- i'd wrap this in a function so you can call it at will :p
    for i = 5, 25 ,5 do
        nuke.Size = Vector3.new(i, i, i)
        nuke.CFrame = pos
    end 
    for i = 25, 5, -5 do
        nuke.Size = Vector3.new(i, i, i)
        nuke.CFrame = pos
    end
end

boom()
0
Thx!! Operation_Meme 890 — 10y
Ad

Answer this question