Help with scooping ice cream animation

What I am trying to achieve?

I am currently working on a simulator game for coding practice. What I'm working on currently is having an ice cream part change size and position smoothly when the player scoops it.

What is the issue?

There is an IntValue inside the ice cream part's parent that determines the size of the ice cream. How sizing works is:, size.Value/1.5, size.Value). The sizing works fine, however I don't know how to determine what Y position to change the part to for it to be lying on the ground. Is there some method or equation to find out how far down to move the part based on the change in size?

What solutions have I tried so far?

Mainly just messing around with subracting and dividing based off of the original Y position and the parts size, but I can't get it to work.
Here's my current code (I took out the Y position edits, as my most recent attempt did not work at all):
local model = script.Parent
local size = model.size
local part = model.part

local replicatedStorage = game:GetService("ReplicatedStorage")
local remotes = replicatedStorage.remotes
local scoop = remotes.scoop

scoop.OnServerEvent:connect(function(player, _model)
	if _model == model then
		size.Value = size.Value - 1

	if size.Value == 0 then
	local position = part.Position
	local goal = {Size =, size.Value / 1.5, size.Value)}
	local tweenInfo =
	local tween = game:GetService("TweenService"):Create(part, tweenInfo, goal)
1 Like

As easily as you can do it you can scale the model or part,and use properties to know the exact Y position you want

You could get the size of the scoop and then just position it down using that.

EDIT: Fixed an error in the code whoops.

If this is the scoop size:

local scoopSize =,4,4)

then you can do something like:

local dist = math.abs(scoopSize.Size.Y - ground.Position.Y)
scoopSize.Position = scoopSize.Position -, dist, 0)

I was thinking about magnitiude and using it based on the difference but I don’t think that would work based on size because I’m almost positive that magnitude is based on the center of the object and scaling it wouldn’t affect that.

You should move the part down by 1/2 the distance you scaled it down by. For example, if you increased the Y axis of the part from 3 studs to 4 studs, you increased it by 1 stud (4 studs - 3 studs = 1 stud). That means you should move the position up by 0.5 studs, since 1/2 of 1 is 0.5 .

1 Like

Wow, I can’t believe I didn’t realize something so simple. You’re a life saver, thanks!
It’s working great…