I took this code and made it this:
plr.Character.Gum.CFrame = plr.Character.Head.CFrame:ToWorldSpace(CFrame.new(plr.Character.Gum.Size.x/2))
and got this error:
ServerScriptService.GravityIncrease:11: invalid argument #1 to ‘new’ (Vector3 expected, got number)
Sry I’m horrible with CFrame stuff XD
Use Vector3.New() inside of the CFrame.New() and set the values of vector with the ones that were provided.
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)
Hmmm… something’s still off. Here’s my code:
plr.Character.Gum.CFrame = plr.Character.Head.CFrame:ToWorldSpace(CFrame.new(0,0,plr.Character.Gum.Size/2))
Also, here’s the game, I just made it public if you want to try it for yourself:
OH, hold up, forgot the X. Let me try that
Hmmm… Yeah something is still not right. I just published the game if you can try it out and see…
Well do you have it so that every time you click, the CFrame is being readjusted?
Yes. I do. Do you need the full script?
Yea you could paste the full script
Yes. Give me one second. My studio just legit crashed… gotta reopen it
Ok here you go:
Gum Handling:
game.ReplicatedStorage.IncreaseGravity.OnServerEvent:Connect(function(plr,increase)
plr.leaderstats.Bubbles.Value = plr.leaderstats.Bubbles.Value + 1
local humanoid = plr.Character:WaitForChild("Humanoid")
humanoid.JumpPower = humanoid.JumpPower + increase
plr.Character.Gum.Size = plr.Character.Gum.Size + Vector3.new(1,1,1)
plr.Character.Gum.HeadPart.Size = plr.Character.Gum.HeadPart.Size + Vector3.new(1,1,1)
plr.Character.Gum.CFrame = plr.Character.Head.CFrame:ToWorldSpace(CFrame.new(0,0,plr.Character.Gum.Size.X/2))
end)
Part of the characterAdded event:
plr.CharacterAdded:Connect(function(char)
local clonedGum = game.ReplicatedStorage.Gum:Clone()
clonedGum.Parent = char
local weld = Instance.new(“Weld”)
weld.Part1 = char.Head
weld.Part0 = clonedGum
clonedGum.CFrame = char.Head.CFrame
weld.C0 = clonedGum.CFrame
weld.C1 = char.Head.CFrame
weld.Parent = clonedGum
clonedGum.CFrame = char.Head.CFrame:ToWorldSpace(CFrame.new(0,0,plr.Character.Gum.Size.X/2))
end)
There is a glitch where when you click, it pushes you to the side a bit.
yes. idk what is up with that either…
I’m not sure if the gum
variable refers to a model or a part. If it’s a model you have to use the SetPrimaryPartCFrame
method on it…
There is no model that I’m cloning. Just a part.
On the ToWorldSpace, should the player.Character.Gum.Size.X/2 be the first number for the CFrame?
Try making an Accessory for the gum to weld it to the player’s head.
- Make an accessory, name it something like “BubbleGum”.
- Put the gum part in the accessory and name it “Handle”.
- Insert an attachment in the handle, it’s name will be the attachment in the rig of the same name that it will be welded to (for example, naming it “HairAttachment” will weld it to the attachment called “HairAttachment” in the rig.
In this case, find an attachment in the rig that’s in front of the head. If there isn’t any, name the attachment to “HatAttachment”. - Parent the accessory to the rig and see how it looks.
- If it isn’t placed right, position the accessory’s attachment differently until you get a good result.
Ok. Trying this right now. Should I anchor the handle?
No. This is just like welding, except it’s for the player.
Hmmm… it isn’t even showing up inside of the character… strange
plr.CharacterAdded:Connect(function(char)
local clonedGum = game.ReplicatedStorage.BubbleGum:Clone()
clonedGum.Parent = char
end)
I made it an accessory, handle, and attachment called HairAttachment. I’ll try HatAttachment