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

Why is the block moving when I increase the size?

Asked by 7 years ago
Edited 7 years ago

My problem is that when I increase the size of a block, it also moves location!

By request, I added the code:

function onTouched(part)
    part:Destroy()
end

game.ServerStorage.CoreTemp.Changed:connect(function()
    if game.ServerStorage.CoreTemp.Value == 10000 then
        for i=1, 2048 do    
            game.Workspace.Boom.Size = Vector3.new(i,i,i)
            game.Workspace.Boom.Position = Vector3.new(0,0,0)
            game.Workspace.Boom.Touched:connect(onTouched)
            wait()
        end
    end
end)
0
Is it near another block, if so. Does the block move above the other block? Odiosus_Ancilla 34 — 7y
0
it goes on top of the other block AlphaGamer150 101 — 7y
0
so ya AlphaGamer150 101 — 7y
0
Can you include the code you are using. User#5423 17 — 7y
View all comments (2 more)
0
ok AlphaGamer150 101 — 7y
0
use cframe, might fix it. ive had the same problems in the past Kyokamii 133 — 7y

1 answer

Log in to vote
1
Answered by 7 years ago

NEVER use Position when changing the Position of a part. Instead, use CFrame. Using Position can give you unexpected results.

function onTouched(part)
    part:Destroy()
end

game.ServerStorage.CoreTemp.Changed:connect(function()
    if game.ServerStorage.CoreTemp.Value == 10000 then
            for i=1, 2048 do    
            game.Workspace.Boom.Size = Vector3.new(i,i,i)
            game.Workspace.Boom.CFrame = CFrame.new(0,0,0)
            game.Workspace.Boom.Touched:connect(onTouched)
            wait()
        end
    end
end)

This should work.

0
Thanks AlphaGamer150 101 — 7y
0
Using position doesn't give unexpected results. It's expected that a part moves ontop of another part when you chance its position because of colissions. RubenKan 3615 — 7y
Ad

Answer this question