Item not welding to npc's hand

Hey so I made this cutscene where the boy grabs a teddy bear during the scene but the teddy bear wont weld to the boy’s hand, anyone know why.

Here’s the script if needed

local playButton = script.Parent
local camera = workspace.CurrentCamera
local rig = workspace.Boy
local teddyBear = workspace.Teddy
local animationId = "rbxassetid://136167262745204"
local animationSpeed = 0.25

local function playCutscene()
	playButton.Visible = false

	local humanoid = rig:FindFirstChild("Humanoid")
	if humanoid then
		humanoid.PlatformStand = true
	end

	local originalCFrame = camera.CFrame
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = workspace.CutsceneCamera.CFrame

	local animator = rig:FindFirstChild("Humanoid"):FindFirstChild("Animator")
	if animator then
		local animation = Instance.new("Animation")
		animation.AnimationId = animationId
		local track = animator:LoadAnimation(animation)

		track:AdjustSpeed(animationSpeed)

		track:GetMarkerReachedSignal("GrabTeddy"):Connect(function()
			if teddyBear:IsA("Model") and teddyBear.PrimaryPart then
				local teddyPrimary = teddyBear.PrimaryPart
				local leftHand = rig:FindFirstChild("LeftHand")

				if leftHand then
					teddyPrimary.CFrame = leftHand.CFrame

					local weld = Instance.new("WeldConstraint")
					weld.Part0 = teddyPrimary
					weld.Part1 = leftHand
					weld.C0 = teddyPrimary.CFrame:Inverse() * leftHand.CFrame
					weld.Parent = leftHand

					print("Teddy bear successfully welded to LeftHand!")
				else
					warn("LeftHand not found in the rig!")
				end
			else
				warn("Teddy bear does not have a PrimaryPart or is not a model!")
			end
		end)

		track:Play()
		track.Stopped:Wait()
	end

	camera.CameraType = Enum.CameraType.Custom
	camera.CFrame = originalCFrame
	playButton.Visible = true
end

playButton.MouseButton1Click:Connect(playCutscene)


mmmm this looks like it belongs in #help-and-feedback:scripting-support

See if they can help you over there!

1 Like