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

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

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

1 comment

0

I would recommend moving it to ServerStorage and cloning it from there

1 answer

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.

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