The script runs perfectly but it won't weld the part to the player...

UserInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer

local function onInputBegan(input,gameProcessed)
	if input.UserInputType == Enum.UserInputType.Keyboard then
		local keyPressed = input.KeyCode
		print("A key is being pushed down! Key:",input.KeyCode)
		
	

    print('working')
print(input.KeyCode)

	if input.KeyCode == Enum.KeyCode.B  then
    x = script.BBall
	x:Clone().Parent = workspace
    local m = Instance.new('Weld', player.Character.Torso)
    m.Part0 = x
    m.Part1 = player.Character:WaitForChild('Torso')
    m.C1 = CFrame.fromEulerAnglesXYZ(0, 0, 0) *CFrame.new(0,-1.5, 0)
	
		print('Done')
	end
	end

end
 
UserInputService.InputBegan:connect(onInputBegan)