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

Why does my ball go on top of of my box when resizing with a script?

I have this ball I need to resize only by a script. It is inside of a box. But whenever it is being resized by the script, it goes on top of the box? The ball is non-collidable and anchored. I'm betting this has something to do with ROBLOX's physics

local ball = game.Workspace.Ball
local db = true

script.Parent.Touched:Connect(function()
	if not db then
		return 
	end
	
	db = false

	for i = 1,25 do
		ball.Size = Vector3.new(i,i,i)
		wait(0.05)
	end

	wait(1)
	db = true
	
end)

The box is 5x5x5 and the ball is 1x1x1.

Why does the ball not go through the box?

1 answer

This is an issue with, like you said, ROBLOX Physics. There are a few ways to get around this. One is (if it is non-collidable and anchored) store the position of the ball in a variable, then "teleport" the ball back to it's old position after resizing it. If this doesn't work, I recommend using CFrames instead.

2 comments

0

I tried that and it didn't work so i will try CFrames

0

CFrames will work for sure.

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