Bubble Gum Sim Game | How to make the gum stick to player

Hello! I am attempting to make a game similar to Bubble Gum Simulator. Does anyone know how I can script (or weld it) so that I can make a part (the gum ball) stay right in front of the character’s head even when I resize it? Hope that makes sense…

2 Likes

Do you have any code? Also, you’ll need to weld the part to the head of the players character.

3 Likes

Yes, I have code. I currently have it so that when the player joins, I clone a gum, then put the clone in the character and weld it to the head. However, when I resize the X, Y, and Z of the gum all by one stud, it get’s bigger and then goes into the character. Let me record a quick video to show you.

3 Likes

I know what you mean, you may need to make the part move using the Y or Z axis (depending on where it is located)

2 Likes

ok… any suggestions on how to do this? sry

2 Likes

You may need to use the CFrame option which will move it an increment. You’ll need to tune values to see what’s best.

1 Like

Ok, I’ll take a look… do you know how I can find the direction I’d need to move the gum? This is the hardest part for me

2 Likes

It’s very simple. Think of an XY graph. The X axis is moving horizontally while the y axis is moving vertically. You’ll need to move it horizontally in a small increment to move it outside if the head.

1 Like

Ok, yes. Will I then have to worry about the Z axis? Because Roblox is 3d? What if the player is facing toward the Z axis instead of the X?

2 Likes

You don’t need to worry about that, all it’ll do is move on the x axis of the head.

1 Like

Ok. Would it help to share my script so far?

2 Likes

To give you some pointers, every time you resize the sphere (which is your bubble), you should reposition the sphere.

You want the edge of the sphere to be in contact with the player’s head/mouth area. So you could do:

Something like that. Basically, the center of the sphere has to be half the sphere size distance away from the player.

Edit: Edited the CFrame

3 Likes

Ok thanks. Let me try this out.

1 Like

I took this code and made it this:
and got this error:
ServerScriptService.GravityIncrease:11: invalid argument #1 to ‘new’ (Vector3 expected, got number)
Sry I’m horrible with CFrame stuff XD

2 Likes

Use Vector3.New() inside of the CFrame.New() and set the values of vector with the ones that were provided.

1 Like

Yea I forgot to include the x and y component in the CFrames, so you should make it
CFrame.new(0,0,plr.Character.Gum.Size.x/2)

2 Likes

Hmmm… something’s still off. Here’s my code:

Also, here’s the game, I just made it public if you want to try it for yourself:

1 Like

OH, hold up, forgot the X. Let me try that

2 Likes

Hmmm… Yeah something is still not right. I just published the game if you can try it out and see…

1 Like

Well do you have it so that every time you click, the CFrame is being readjusted?

2 Likes