Hello, so recently I’ve began working on a delivering system for one of my games, It’s going great but I’m running into an issue that I cannot seem to fix AT ALL.
So how this works is a player enters a zone and receives a box, they have to deliver it, the issue is the the box isn’t CFraming properly, I want the box’s CFrame to be set to Character.UpperTorso.BodyFrontAttachment.CFrame and I’ve tried setting it but this is what I get as a result:
The way I would like it to turn out is something similar to this:
Here is the code behind it:
local animator : Animator = self.character.Humanoid.Animator
self.holdingBoxAnimation = Instance.new('Animation')
self.holdingBoxAnimation.AnimationId = deliveringData.holdingBoxAnimation
local preloadList = {
self.holdingBoxAnimation
}
contentProviderService:PreloadAsync(preloadList)
animator:LoadAnimation(self.holdingBoxAnimation):Play()
self.box = gameResources.DeliveringJob.CardboardBox:Clone()
self.box.Parent = self.character.RightHand
local weldConstraint = Instance.new('Weld')
weldConstraint.Parent = self.character.RightHand
weldConstraint.Part0 = self.box
weldConstraint.Part1 = self.character.RightHand
weldConstraint.C0 = weldConstraint.Part0.CFrame
weldConstraint.C1 = self.character.UpperTorso.BodyFrontAttachment.CFrame
As you can probably tell, this isn’t the full code but rather the part that is running the weld, if you need to view more code let me know.