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

When I resize a part through a script, It moves up for some reason, any way to fix this?

Asked by 7 years ago
Edited 7 years ago

So I'm making a feature for admins to be able to use a nuke feature like the game "THE BORDER". The problem is, when I go to resize the ring thats supposed to kill everyone (Kinda like a blast wave), it moves upward as the size grows bigger. Is there any way to make it so it stays in one spot while it grows? Thanks for the help!

Here is the ring behavior:

Anchored = true CanCollide = false CollisionFidelity = box Locked = false

Here's the script where it resizes:

for i=150,2048, 25 do
    wait(0.1)
    game.workspace.Ring.Size = Vector3.new(i, 2.13, i) 
end

NOTE: It also gets cloned into the workspace

    game.Lighting.Ring:Clone().Parent = game.workspace
0
I would recommend moving it to ServerStorage and cloning it from there pluginfactory 463 — 7y

1 answer

Log in to vote
1
Answered by 7 years ago

Set it's CFrame after sizing it.

for i=150,2048, 25 do
    cf = game.Workspace.Ring.CFrame
    wait(0.1)
    game.Workspace.Ring.Size = Vector3.new(i, 2.13, i) 
    game.Workspace.Ring.CFrame = cf
end

Cframe is a value which includes part's rotation and position. Sizing a part will move that part closest free space on top of it. That's why you need to set it's CFrame after sizing it. Note: Positioning will do same thing, you need to use CFrame to make it move into other parts.

Ad

Answer this question