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

Why is the block moving when I increase the size?

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)

6 comments

0

Is it near another block, if so. Does the block move above the other block?

0

it goes on top of the other block

0

so ya

0

Can you include the code you are using.

0

ok

0

use cframe, might fix it. ive had the same problems in the past

1 answer

✓ Accepted answer

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.

2 comments

0

Thanks

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.

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